Navigation link: incorrect usage of Tooltip #68597
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Block library
/packages/block-library
[Type] Bug
An existing feature does not function as intended
Description
Similar to #66271 and #68591
This is one more occurrence of incorrect usage of the Tooltip component.
Tooltips should be used to visually expose the accessible name of an interactive control. They're not the right tool to use for descriptions or additional infomration.
In
gutenberg/packages/block-library/src/navigation-link/edit.js
Lines 536 to 538 in 79234bd
and
gutenberg/packages/block-library/src/navigation-link/edit.js
Lines 582 to 601 in 79234bd
The Tooltip wraps a
span
element. As such, the span element gets a tabindex=0 attribute and becomes a non-interactive focusable element.Once again, it is worth reminding that tooltips should not be used to provide information in a 'visual' way, that is: only on mouse hover.
Instead of using tooltips, the invalid or missing link state should be communicated by the visible placeholder text.
For example, when a link is missing, 'Add link' should be 'Missing link' and maybe the item should be visually highlighted in some way as an error or warning.
Step-by-step reproduction instructions
(Invalid)
is added after the link.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.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: