Description
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:
|
<Tooltip text={ label }> |
|
<Button |
|
{ ...props } |
|
className="component-border-radius-control__linked-button" |
|
size="small" |
|
icon={ isLinked ? link : linkOff } |
|
iconSize={ 24 } |
|
aria-label={ label } |
|
/> |
|
</Tooltip> |
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.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Description
It appears that in some cases some
Buttoncomponents use an explicitaria-labelprop to render anaria-labelHTML attribute, which in turn determines the icon button tooltip (if it's an icon button). Example:gutenberg/packages/block-editor/src/components/border-radius-control/linked-button.js
Lines 12 to 21 in 91272a2
This pattern should be audited across the entire codebase as it's not a best practice.
Setting an explicit
aria-labelsignals two possible cases, both less than ideal:aria-labelis used in a way that the accessible name mismatches the Button text or tooltip. This is not OK for accessibility.aria-labelis just unnecessary, like in the example above. In that case, the wrapping Tooltip component uses the samelabelvariable used foraria-label. In this case, the Tooltip component can be removed and the variable passed to thelabelprop 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.