-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Allow user to specify separate off event for the tooltip #103
Conversation
dataEventOff = this.state.eventOff || targetArray[i].getAttribute('data-event-off'); | ||
// if off event is specified, we will show tip on data-event and hide it on data-event-off | ||
if (dataEventOff) { | ||
targetArray[i].removeEventListener(dataEvent, this.showTooltip); |
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 don't think this can work because if you check the method checkStatus
, you will find there are more things than showTooltip and hideTooltip. So it would be better if dataEventOff can work well with checkStatus
(you don't have to use that method, I just mean maybe you can refer to it)
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 haven't tested it thoroughly, but so far it works :-) To be honest, I don't fully understand the checkStatus method. Seems like it's there just to make sure that when the "event" happens, it closes the tooltip if it is opened, or opens it if it is closed, which you don't need when the opening/closing is bound to different events.
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.
Yeah, pretty much, but checkStatus also creates a listener for when click other place, the tooltip should be removed
, so I don't know if dataEventOff can compatible with this feature or maybe we don't need that feature if user has set dataEventOff. I need to think about it and advices are welcome.
Could you resolve the conflicts, I plan to merge this PR and do some modification, thanks |
# Conflicts: # dist/react-tooltip.js # dist/react-tooltip.min.js # standalone/react-tooltip.js # standalone/react-tooltip.min.js
# Conflicts: # dist/react-tooltip.js # dist/react-tooltip.min.js # standalone/react-tooltip.js # standalone/react-tooltip.min.js
Hi, conflict is resolved. |
Merging, thanks, will release new version soon |
If the user wants to hide the tooltip using a different event than the one used for showing it, he can use the data-event-off attribute.