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

[FEATURE] Allow tip hiding on its outside click #22

Merged
merged 1 commit into from May 15, 2013
Merged

[FEATURE] Allow tip hiding on its outside click #22

merged 1 commit into from May 15, 2013

Conversation

afoeder
Copy link
Contributor

@afoeder afoeder commented May 15, 2013

This adds an option hideOnTipOutsideClick which will
hide the Tip if the document is clicked somewhere outside
the ToolTip resp. its initial trigger element.

Apparently this only makes sense if no contradicting
hideOn option is set, as it would be the case in most
mouseleave cases because there would be no opportunity
to click outside if the Tip is just hiding anyways.

See #21

This adds an option `hideOnTipOutsideClick` which will
hide the Tip if the document is clicked somewhere outside
the ToolTip resp. its initial trigger element.

Apparently this only makes sense if no contradicting
`hideOn` option is set, as it would be the case in most
`mouseleave` cases because there would be no opportunity
to click outside if the Tip is just hiding anyways.

Fixes #21
@lorenzos
Copy link
Owner

Let's discuss about if it's better to provide a new option (like you did), or allow a special value for the existent hideOn option (let's say 'clickOutside'). For me the second is a better choice, for the reason you can't make the "contradictions" you told about.

@afoeder
Copy link
Contributor Author

afoeder commented May 15, 2013

I began to use a special value but soonish stumbled upon the fact that the showOn and hideOn exclusively affect the "trigger" of the tip and not the tip itself. When introducing pseudo-options, it should made clear what they affect. clickOutside as you suggested would be insufficient (or, not clear enough) because mouseleave for example means leaving the trigger element, while clickOutside means clicking outside the Tip.

While coding, I had a solution like hideOn: 'outsideTipClick' but that contradicted the current implementation at all, because whatever is written down there is considered as immediate event.
This maybe needs some refactoring anyways ;)

I will say, if we add and support a outsideTipClick option, we have to circumvent this case in the place where the events are added (evs[s.options.showOn]... you know), and we don't have a way to distinct between "special" values and "immediately usable" values...

Hope you know what I mean... What do you think?

@lorenzos
Copy link
Owner

I think you thought about it much more than I did. Jokes apart, yes, your arguments are surely valid. I'm merging.

Thank you again, excellent work.

lorenzos added a commit that referenced this pull request May 15, 2013
[FEATURE] Allow tip hiding on its outside click
@lorenzos lorenzos merged commit 6aebbdb into lorenzos:master May 15, 2013
@afoeder afoeder deleted the issues/21/hideOnTipOutsideClick branch May 15, 2013 15:55
@afoeder
Copy link
Contributor Author

afoeder commented May 15, 2013

hihi yeah; I was also full of euphoria but when writing around in the code I realized every way has some drawbacks ;)
In favor of making slight enhancements I didn't refactor a big chunk but only this "additive" feature; as soon as I find some love and mind I'll give it another approach :)

Thanks for being so active!

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