You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:
Pass down the renderDialog prop as it is supposed to be used.
Attach the useDialog props to the component only when it is expected to work with a modal behavior i.e. when renderDialog is true.
Improve the renderDialog docs.
TL;DR
#59622 made the EntitiesSavedStates component behave like a modal dialog when the new renderDialog prop is true. However, the props from useDialogare 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 way role=dialog, aria-labelledby, and aria-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. When renderDialog is false, none of the props related to the modal dialog should be set.
How?
Passes the useDialog props conditionally based on renderDialog.
Observe the modal dialog does not close unexpectedly any longer.
Make styles changes in the Site editor or preview a block theme in the editor.
Click the 'Save' or 'activate theme' button at the top right of the screen: the entity saved state component renders in the right sidebar.
Inspect the source and observe the element with class entities-saved-states__panel does have a role=dialog and correct aria-labelledby and aria-describedby.
Note: when there are changes, this component may still be rendered in the DOM even when it is closed and it's hidden via CSS.
These are the ARIA properties for the component in the Site editor:
And these are the ones for the theme preview:
Check that wherever the entity saved state component renders in the right sidebar:
It closes when clicking outside of it.
It has correct aria role, aria-labelledby and aria-describedby.
For example, this should be checked also in the Post editor, after editing a template from the post editor and saving, the entity saved state component is used instead of the normal publish panel.
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 props-bot label.
If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
Flaky tests detected in 843d9ef.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
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.
The 'close when clicking outside' behavior no longer works in the post editor
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.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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