-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make tooltips dismissable #8147
Conversation
Is it likely this will be resumed, or can it be closed? |
Closing as stale without response. It can be reopened if development is expected to continue, or a new pull request can be submitted. |
Actually, I was waiting for some feedback 🙂
Noting that, technically, tooltips are not WCAG compliant because they should be dismissable by the user. I'm not so skilled to propose solutions other than the one in this PR. If anyone can come up with better ideas, please do. Thanks. |
Stale label application is indiscriminate, with the subsequent closure delayed to allow time for corrections. Apologies for the missed subnote of the comment. Reopening, and I'll follow-up with thoughts on how to proceed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To the question of handling escape, it seems like one way to achieve this would be through rendering a <KeyboardShortcuts />
element from the Tooltip
component when it's visible, which would respond to the Escape press by having itself be made hidden (managing isOver
state, which at that point ought to be considered for rename).
To avoid an issue of conflicting Escape handling between it and that of the "clear selected block" behavior, it would probably need to be implemented as wrapping the children
(button or whatever else the tooltip is attached to) rendered by Tooltip
, leveraging the feature of KeyboardShortcuts
to "capture key events which occur on or within the children" and stopping propagation to avoid other handling.
I could help assist with this. There are conflicts which will need to be resolved first. I could look to resolve them too.
@@ -119,7 +119,9 @@ class Tooltip extends Component { | |||
createToggleIsOver( eventName, isDelayed ) { | |||
return ( event ) => { | |||
// Preserve original child callback behavior | |||
this.emitToChild( eventName, event ); | |||
if ( event.type !== 'mousedown' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about click
? Noting since it's mentioned in the text of the original comment.
Created a tracking issue for this PR: #15145 with "Needs dev" label |
Thank you @afercia. Let's close this one in the meantime 🙇 |
Work in progress, please don't merge.
This PR is a first attempt to improve the tooltips behaviour after #8033. As mentioned there and in the related issue, tooltips should persist when hovered. However, as correctly pointed out, they should also be dismissable by users.
WCAG reference:
Success Criterion 1.4.13 Content on Hover or Focus
https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus
https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html
there are 3 items to address to meet the requirement:
More details on #8033 and the related issue.
By making use of
onMouseDown
this PR seeks to solve two issues:click
event to be passed to the button and trigger the associated actioncursor: default
style to the tooltipTodo:
Any help would be greatly appreciated.