-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Description
Discovered while working on #67313 / #67351
When it is used with a modal behavior attached, the EntitiesSavedStates component has a role=dialog' and it's labelled via an
aria-labelledby` attribute that points to these part:
gutenberg/packages/editor/src/components/entities-saved-states/index.js
Lines 163 to 171 in f8140c4
<div | |
className="entities-saved-states__text-prompt--header-wrapper" | |
id={ renderDialog ? dialogLabel : undefined } | |
> | |
<strong className="entities-saved-states__text-prompt--header"> | |
{ __( 'Are you ready to save?' ) } | |
</strong> | |
{ additionalPrompt } | |
</div> |
The problem with that, is that when additionalPrompt
is passed, it makes part of the dialog labeling which:
- Makes the dialog labeling potentially too long and misleading.
- The
additionalPrompt
text is meant to be more an additional description rather than a label.
For example. in the Theme preview in the Site editor the label of the dialog is as follows:
Are you ready to save? Saving your changes will change your active theme from Twenty Twenty-Five to Twenty Twenty-Four."
That's used for the label and it's way too long. The second part should be used for the description and the labeling should only be the first part: Are you ready to save?
.
Step-by-step reproduction instructions
First, apply the changes from #67351 if it's hasn't been merged yet as that PR fixes the labeling of the dialog.
- Go to the WP admin > Appearance > any non-acitve block theme > Live preview.
- The editor opens to preview the theme.
- Click the editor canvas to switch to edit mode.
- Click the button 'Activate {theme name}' at the top right of the screen.
- Inspect the DOM and select the element with role=dialog and class
entities-saved-states__panel
. - In the dev tools inspector accessibility tab observe that the text passed as
additionalPrompt
is used in the labeling of the element.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure