Repository navigation
Conversation
A BBButton tooltip shown on hover or keyboard focus can only be closed by moving the pointer away or moving focus elsewhere. It can cover nearby content, and WCAG 1.4.13 (Content on Hover or Focus) requires such content to be dismissible without moving the pointer or focus. Add a shared Tippy plugin, `hideOnEsc`, that hides the tooltip when Escape is pressed, and pass it to the button's Tippy. The `keydown` listener is added to the document only while the tooltip is shown and removed when it hides or is destroyed. The tooltip shows again on the next hover or focus. The plugin lives in `src/utils/tooltip.ts` so every component with a Tippy tooltip can use it. The Escape event is not stopped, as in the MUI Tooltip: stopping it would also hide it from the consumer's own handlers while a tooltip is shown.
The header tooltip of BBBAccordion can only be closed by moving the pointer away or moving focus elsewhere, which falls short of WCAG 1.4.13 (Content on Hover or Focus). Pass the shared `hideOnEsc` plugin to its Tippy, as BBButton does, so Escape hides the tooltip.
The name tooltip of BBBAvatar can only be closed by moving the pointer away, which falls short of WCAG 1.4.13 (Content on Hover or Focus). Pass the shared `hideOnEsc` plugin to its Tippy, as BBButton does, so Escape hides the tooltip.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Tooltips on
BBButton,BBBAccordionandBBBAvatarnow close when Escape is pressed, without moving the pointer or focus.tooltipLabeltooltip ofBBButtonandBBBAccordionand the name tooltip ofBBBAvatar.Motivation
A tooltip can cover nearby content, and the only way to close it is to move the pointer or focus away, which falls short of WCAG 1.4.13 (Content on Hover or Focus).
More
BBBCheckboxonce fix(BBBCheckbox): show keyboard focus and disabled state; add tooltip and helper text #117 is mergedBBBToggleonce fix(BBBToggle): show keyboard focus and disabled state; add tooltip #118 is merged