Repository navigation
Tools panel: avoid unnecessary mismatch between visible label and accessible name #65241
Copy link
Copy link
Closed
Closed
Copy link
Labels
[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components/packages/components[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
In the Tools panel, the aria-label attributes for the elements that are shown / hidden and reset mismatch the visible text. As such, this is a mismatch between vissual label and actual accessible bane that is a barrier for some users.
This kind of mismatch should always be avoided. For example:
- The visibele text is
H2. - The actual accessible name is either
Show H2orHide and reset H2. - This is:
- Confusing for sighted screen reader users.
- An actual barrier for speech recognition / voice control users.
Worth also reminding the label of a control i.e. its accessible name is not the right place to communicate states or values.
gutenberg/packages/components/src/tools-panel/tools-panel-header/component.tsx
Lines 101 to 111 in b1c9676
| const itemLabel = isSelected | |
| ? sprintf( | |
| // translators: %s: The name of the control being hidden and reset e.g. "Padding". | |
| __( 'Hide and reset %s' ), | |
| label | |
| ) | |
| : sprintf( | |
| // translators: %s: The name of the control to display e.g. "Padding". | |
| __( 'Show %s' ), | |
| label | |
| ); |
Step-by-step reproduction instructions
- Go, for example, to Site Editor > Styles > Colors > Elements > Elements options (the ellipsis icon button)
- Open the Elements options popover.
- Observe the toggleable items in the menu have a visible text like
H1,H2, etc. - Observe the aria-label of these items is either
Show H1,Show H2, etc. orHide and reset H1,Hide and reset H2, etc. depending on the state.
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components/packages/components[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended

Activity
afercia commentedon Sep 11, 2024
I would argue that also from a visual design perspective, the entire tools panel purpose and functionality isn't clear.
Elements options.Elements.aria-label="Elements options"so this is one more mismatch between visible label and accessible name.Elementsvia anaria-labelledby="components-menu-group-label-1"which just adds more confusion.As a user, I'd only understand what this menu is about only after I try to use it and _only if I'm able to notice that new items appear or are removed from the main panel. To me, any UI should be self-explanatory instead of forcing users to 'try and discover' to learn how it works.
carolinan commentedon Apr 12, 2025
Shouldn't the aria-label be removed? The button has a visible text.
aaronrobertshaw commentedon Oct 23, 2026
This was fixed by #84341. Each menu item now starts with the name you see, for example "H2, show" or "H2, hide and reset". Closing, but feel free to reopen if you find a case that still doesn't match.