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

Document that calling tooltip/popover .show()/.hide() qualifies as manual triggering #15465

Closed
markkolich opened this issue Dec 30, 2014 · 5 comments
Labels
Milestone

Comments

@markkolich
Copy link

According to http://getbootstrap.com/javascript/#popovers there doesn't appear to be a way to auto-hide a popover, that is manually shown/triggered, after some interval.

As such, I end up doing this in my application:

button.popover('show');

setTimeout(function() {
  button.popover('hide');
}, button.attr('data-delay-hide') || 2000);

Looking at the documentation on the data-delay attribute for popovers, I see "does not apply to manual trigger type". I conjecture my button.popover('show') falls into this manual trigger category and as a result I'm responsible for hiding the popover myself?

Somewhat expected, I tried <button data-delay='{"hide":3000}'> without the JS above and this failed miserably.

Shouldn't a popover I trigger manually be hidden after the hide delay I provide in the data-delay attribute? If not, I'd like to suggest an update the documentation at http://getbootstrap.com/javascript/#popovers to be a bit clearer with a red callout highlighting this limitation.

@cvrebert
Copy link
Collaborator

there doesn't appear to be a way to auto-hide a popover, that is manually shown/triggered, after some interval.

Correct, there's no built-in way. That's kinda the nature of manual (non-auto) triggering. Showing/hiding of the tooltip is under your complete (but manual) control.

I conjecture my button.popover('show') falls into this manual trigger category and as a result I'm responsible for hiding the popover myself?

Correct. Perhaps we should add an explanation in the .tooltip('show') and .tooltip('hide') docs that calling those methods qualifies as a "manual" triggering. I agree it could be made clearer.

Shouldn't a popover I trigger manually be hidden after the hide delay I provide in the data-delay attribute?

Well, since delay is explicitly documented as not being applicable in that case, no.
And changing the behavior would break backward-compatibility, so even if want to make that change, it would have to wait until Bootstrap v4.

Philosophically speaking, honoring delay in the manual case makes things less manual, and as you've shown, the behavior you desire is still easy to implement even without this feature. It would also complicate the tooltip code slightly, since the delaying in the non-manual cases is currently done by the caller of hide/show, rather than in the hide/show methods themselves.
It's not completely out of the question, it's just the design decision that @fat made when he added the delay option.

If not, I'd like to suggest an update the documentation at http://getbootstrap.com/javascript/#popovers to be a bit clearer with a red callout highlighting this limitation.

We're trying to cut down on callouts actually (it's a "if everything is top-priority, then nothing is" problem). Given that we've had few, if any, other complaints about this particular issue, a callout doesn't seem warranted yet.

@cvrebert cvrebert changed the title Auto-hide manually triggered popover's Auto-hide manually triggered popovers Dec 30, 2014
@markkolich
Copy link
Author

Thanks for the clarifications.

Philosophically speaking, honoring delay in the manual case makes things less manual, and as you've shown, the behavior you desire is still easy to implement even without this feature.

Yep, understandable.

To be honest, I think the way it behaves now is fine. At first, I was a bit "ugh, really?" when I realized that I had to setTimeout all over the place to hide manually triggered popovers, but given the design and some further reflection it all makes sense.

We're trying to cut down on callouts actually (it's a "if everything is top-priority, then nothing is" problem). Given that we've had few, if any, other complaints about this particular issue, a callout doesn't seem warranted yet.

Sure — a callout is overkill.

Just a quick note in the docs somewhere in the section covering popovers would suffice, I think.

@cvrebert cvrebert changed the title Auto-hide manually triggered popovers Document that calling tooltip/popover .show()/.hide() qualifies as manual triggering Jan 6, 2015
@cvrebert cvrebert removed the js label Jan 6, 2015
@cvrebert cvrebert added this to the v3.3.2 milestone Jan 6, 2015
@bitcity
Copy link

bitcity commented Jan 20, 2015

Sorry for commenting on a closed issue. I saw this via 3.3.2 release notes today.

If I call show on a tooltip, it still respects the hide delay (despite it being a manual trigger).

http://jsfiddle.net/on6czwz2/3/ . Is my understanding of this issue incorrect?

@cvrebert
Copy link
Collaborator

Your $(this).tooltip('show') counts as manually triggering a show.
In contrast, the hiding when the mouse hovers away is automatic; indeed, your example code contains no manual .tooltip('hide'). You could disable the automatic hover event handler by setting the trigger option to an appropriate value.

In other words, the manual-ness only applies to the immediate action and doesn't infect other actions (like the subsequent hide).

@bitcity
Copy link

bitcity commented Jan 20, 2015

the manual-ness only applies to the immediate action and doesn't infect other actions (like the subsequent hide).

This is good to know. It wasn't apparent from the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants