It appears that in some cases some Button components use an explicit aria-label prop to render an aria-label HTML attribute, which in turn determines the icon button tooltip (if it's an icon button). Example:
This pattern should be audited across the entire codebase as it's not a best practice.
Setting an explicit aria-label signals two possible cases, both less than ideal:
The aria-label is used in a way that the accessible name mismatches the Button text or tooltip. This is not OK for accessibility.
The aria-label is just unnecessary, like in the example above. In that case, the wrapping Tooltip component uses the same label variable used for aria-label. In this case, the Tooltip component can be removed and the variable passed to the label prop of the Butotn.
Step-by-step reproduction instructions
N/A
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
[x] Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Description
It appears that in some cases some
Button
components use an explicitaria-label
prop to render anaria-label
HTML attribute, which in turn determines the icon button tooltip (if it's an icon button). Example:https://github.com/WordPress/gutenberg/blob/91272a2b4bfca1f75a6754a0f3689c3a42988f0c/packages/block-editor/src/components/border-radius-control/linked-button.js#L12-L21
This pattern should be audited across the entire codebase as it's not a best practice.
Setting an explicit
aria-label
signals two possible cases, both less than ideal:aria-label
is used in a way that the accessible name mismatches the Button text or tooltip. This is not OK for accessibility.aria-label
is just unnecessary, like in the example above. In that case, the wrapping Tooltip component uses the samelabel
variable used foraria-label
. In this case, the Tooltip component can be removed and the variable passed to thelabel
prop of the Butotn.Step-by-step reproduction instructions
N/A
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.