-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
[Tooltip] Allow to interact with the tooltip #13305
Conversation
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.
The noninteractive behavior was done on purpose. But I can understand the use case.
If we want to move forward, I think that we should put this feature behind a flag, something like
allowInteraction
or interactive
.
@@ -314,6 +314,10 @@ class Tooltip extends React.Component { | |||
placement={placement} | |||
anchorEl={this.childrenRef} | |||
open={open} | |||
onMouseOver={childrenProps.onMouseOver} | |||
onMouseLeave={childrenProps.onMouseLeave} | |||
onFocus={childrenProps.onFocus} |
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.
Do we need the focus/blur listeners?
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.
It would allow keyboard users to tap to a button inside the tooltip - I guess that’s rather an edge case but adding a little bit accessibility here will not cause any other side effects
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.
Do you have an example? I can understanding the blur usage but not the focus.
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.
Maybe like the drop down nesting example here : https://atomiks.github.io/tippyjs/
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.
But the idea is the same - if you manage to tab over fast enough the tooltip it will stay open - if you then tab further the tooltip should close
I will ass a new interactive prop if you like. Should it be like |
@jantimon Yes, we can follow their convention: <Tippy interactive={true}>
<button class="btn">Interactive (hover)</button>
</Tippy> |
5018daf
to
4abee4c
Compare
@oliviertassinari thanks for your fast feedback 👍 I prepared the feature like you suggested. |
db4d209
to
1c528cf
Compare
@oliviertassinari All tests passed 👍 |
1c528cf
to
ce71211
Compare
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.
It's a great pull request!
ce71211
to
2ec4074
Compare
Hey :)
thanks for your library.
I would like to allow users to interact with the tooltip (similar to the interactive feature of react-tippy).
The current implementation will close the tooltip even if the user moved their mouse cursor above the tooltip.
This pull request will change this and add the mouseOver lister also to the tooltip.
So if you specify a
leaveDelay
and the user manages to move the mouse over to the tooltip within that delay it will stay open.The change also respects the
disableHoverListener
anddisableFocusListener
options.