-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix TooltipTrigger with DialogTrigger #5526
Conversation
Build successful! 🎉 |
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.
I think @LFDanLu had some concerns with this approach from when it was suggested last time https://github.com/adobe/react-spectrum/pull/4195/files#r1136175022
From reading back over it, I don't follow what it was (might've been all theoretical), we just return a smaller set of event handlers now, but they are the same kinds as before. Tested it in hooks docs and new stories are working for me
The concern from before was that the event propagation of the pointer/keyboard events would be inconsistent depending on how the user constructed their TooltipTrigger. If their button within their implemented TooltipTrigger used |
I think that's expected. Tooltips on their own shouldn't stop propagation, because clicks aren't really their main purpose, just a secondary interaction that's not exposed to the app developer. If the button has usePress then they should stop propagation because the click is being handled by the app via the onPress event. |
Build successful! 🎉 |
Build successful! 🎉 |
## API Changes
unknown top level export { type: 'any' } @react-aria/tooltipTooltipTriggerAria TooltipTriggerAria {
tooltipProps: DOMAttributes
- triggerProps: (DOMAttributes & PressProps & HoverProps & FocusEvents)
+ triggerProps: DOMAttributes
} it changed:
|
Closes #3009, closes #4195
This is an alternate fix to #4195. It uses native
onPointerDown
andonKeyDown
to hide tooltips instead ofusePress
. This avoids the double event causing tooltips preventing dialog triggers and other press events from working. It also allows press events on elements with tooltips to propagate rather than blocking interactions which would be unexpected.I tried to add a test but was unable to reproduce the issue in a test environment. I believe this is due to
act
batching the double press events together unlike how it works in the browser.