-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix EntitiesSavedStates panel dialog props. #67351
Fix EntitiesSavedStates panel dialog props. #67351
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +36 B (0%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
Flaky tests detected in 843d9ef. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12117682421
|
Cc @WordPress/gutenberg-core I'd appreciate a review, when you have a chance. |
72480e0
to
843d9ef
Compare
Removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
* Fix EntitiesSavedStates panel dialog props. * Remove renderDialog default value. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mayank-Tripathi32 <mayanktripathi32@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
The 'close when clicking outside' behavior no longer works in the post editor, but it does in the site editor. I'm not sure if it's intentional or a recent regression. |
It works for me. Are you testing the entity saved panel or the normal pubish panel? As in: in the post editor you need to edit something other than the post content to get the enity saved panel e.g. edit the template from the post editor. |
Sorry, I was testing the normal publish panel. However, I expect it to have similar behavior since they share the design. |
I'd agree and I noted it in the issue:
Also, see this comment where there's some related considerations. |
* Fix EntitiesSavedStates panel dialog props. * Remove renderDialog default value. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mayank-Tripathi32 <mayanktripathi32@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Fixes #67313
Alternative to #67327
What?
When the entity saved states component is rendered inside a Modal component, clicking the padding area inside the modal dialog closes the modal unexpectedly.
Basically, this PR seeks to:
renderDialog
prop as it is supposed to be used.useDialog
props to the component only when it is expected to work with a modal behavior i.e. whenrenderDialog
is true.renderDialog
docs.TL;DR
#59622 made the
EntitiesSavedStates
component behave like a modal dialog when the newrenderDialog
prop is true. However, the props fromuseDialog
are always passed unconditionally to the component. As such, the component gets some modal behaviors including the 'close when clicking outside'. This works when the component is rendered in the save panel on the right. I doesn't work well when it is rendered inside a Modal dialog because in this case it's a sort of 'modal behavior' within a 'modal behavior' e.g.: clicking outside the inner component with modal behavior but still inside the outer Modal component closes the modal unexpectedly.Why?
Modal dialogs should not close unexpectedly.
The
useDialog
props should be passed conditionally, in the same wayrole=dialog
,aria-labelledby
, andaria-describedby
are passed conditionally. This makes sure that when the component gets the ARIA attributes related to a modal dialog, it also behaves like a modal dialog. WhenrenderDialog
is false, none of the props related to the modal dialog should be set.How?
useDialog
props conditionally based onrenderDialog
.renderDialog
props, please double check this as it seems to me the docs introduced in Documentation: EntitiesSavedStates editor component #62377 aren't accurate.aria-haspopup="dialog"
attribute.Testing Instructions
entities-saved-states__panel
does have a role=dialog and correct aria-labelledby and aria-describedby.These are the ARIA properties for the component in the Site editor:
And these are the ones for the theme preview:
Testing Instructions for Keyboard
Screenshots or screencast