Skip to content
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

Merged
merged 5 commits into from
Jun 1, 2016

Conversation

ondy1985
Copy link
Contributor

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.

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);
Copy link
Collaborator

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)

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

@wwayne
Copy link
Collaborator

wwayne commented May 31, 2016

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
@ondy1985
Copy link
Contributor Author

Hi, conflict is resolved.

@wwayne
Copy link
Collaborator

wwayne commented Jun 1, 2016

Merging, thanks, will release new version soon

@wwayne wwayne merged commit 43a037c into ReactTooltip:master Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants