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

Tools panel: Synced the visible label and accessible name #68592

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

Conversation

im3dabasia
Copy link
Contributor

Fixes: #65241

What?

Updated aria-labels for Tools Panel items to match their visible text.

Why?

Resolved mismatches between visual labels and accessible names, improving accessibility.

How?

Refactored aria-label generation to reflect visible text directly without adding unnecessary text.

Testing Instructions

  1. Open the Site Editor > Styles > Colors > Elements options (the ellipsis icon button).
  2. Open the Elements options popover.
  3. Observe the toggle-able items in the menu have a visible text like H1, H2, etc.
  4. Verify that the aria-label matches the visible text for toggle-able items.

Screenshots or screencast

Before After
Screenshot 2025-01-10 at 3 36 40 PM Screenshot 2025-01-10 at 3 32 24 PM

@im3dabasia im3dabasia requested a review from ajitbohra as a code owner January 10, 2025 10:07
Copy link

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: im3dabasia <[email protected]>
Co-authored-by: afercia <[email protected]>

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

@im3dabasia
Copy link
Contributor Author

As mentioned in the issue, there is another accessibility concern: the aria-label is set as "Elements options" while the title of the popover is "Elements"

The required change needs to be made in this file. However, removing the word "options" raises an ESLint error (@wordpress/i18n-no-placeholders-only), which prohibits the use of translation functions with placeholders only.

image
Code Reference

const dropDownMenuLabelText = sprintf(
// translators: %s: The name of the tool e.g. "Color" or "Typography".
_x( '%s options', 'Button label to reveal tool panel options' ),
labelText
);

I would love to hear your thoughts on how to approach this part of the issue

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components labels Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tools panel: avoid unnecessary mismatch between visible label and accessible name
2 participants