Skip to content
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

Improve the labeling of EntitiesSavedStates #67473

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

dhruvang21
Copy link
Contributor

@dhruvang21 dhruvang21 commented Dec 2, 2024

Fixes #67354

What?

This PR updates the behavior of the EntitiesSavedStates component when used in a modal dialog (role="dialog") to ensure the dialog labeling is appropriate. Specifically:

The aria-labelledby attribute now references only the primary label text (Are you ready to save?).
The additionalPrompt text is moved to the aria-describedby attribute, ensuring it acts as a supplementary description instead of being included in the dialog label.

Why?

When additionalPrompt is passed, it becomes part of the dialog label, which can make the labeling overly long and misleading. For example, in the Theme preview of the Site Editor, the dialog label currently reads:

"Are you ready to save? Saving your changes will change your active theme from Twenty Twenty-Five to Twenty Twenty-Four."

This excessively long label makes it harder for users, especially those using assistive technologies, to quickly understand the purpose of the dialog. By separating the primary label and the additional descriptive text, we enhance usability and accessibility.

How?

Updated Markup for Descriptions:

  • The additionalPrompt text is now wrapped in a div with an id dynamically assigned when the dialog is rendered (renderDialog).
  • This id is referenced by the aria-describedby attribute of the dialog.
  • The additionalPrompt acts as a supplementary description and is displayed before the main description.

Testing Instructions

  1. Apply the changes from PR Fix EntitiesSavedStates panel dialog props. #67351 if it hasn't been merged yet.
  2. Go to WP Admin > Appearance > any non-active block theme > Live preview.
  3. Open the editor to preview the theme.
  4. Click the editor canvas to switch to edit mode.
  5. Click the "Activate {theme name}" button at the top right.
  6. Inspect the DOM and select the element with role="dialog" and class entities-saved-states__panel.
  7. Verify that:
    The aria-labelledby attribute references only the primary label.
    The aria-describedby attribute includes the additionalPrompt text.

Screenshots or screencast

Screenshot from 2024-12-02 18-11-26

Copy link

github-actions bot commented Dec 2, 2024

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.

Co-authored-by: dhruvang21 <dhruvang21@git.wordpress.org>
Co-authored-by: afercia <afercia@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the labeling of EntitiesSavedStates when used with modal behavior
1 participant