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

Correct hidden.bs and shown.bs events firing too early in tooltip and popover #10199

Merged
merged 1 commit into from Dec 26, 2013
Merged

Correct hidden.bs and shown.bs events firing too early in tooltip and popover #10199

merged 1 commit into from Dec 26, 2013

Conversation

lukaszfiszer
Copy link
Contributor

I notices that tooltip events shown.bs.tooltip and hidden.bs.tooltip fire to early, just after show.bs.tooltip and hide.bs.tooltip, not waiting for CSS transition to end.

Here's a JSBin illustrating the issue: http://jsbin.com/EcaBiSo/2/edit

Popover.js is also affected by this bug as it inherits from tooltip.

This PR corrects this issue.

… tooltip.js

* events fire only after the CSS animation is completed
* this fixes also events in popover.js (as it inherits from tooltip.js)
@Chaser324
Copy link

A similar issue seems to be impacting closed.bs.alert triggered in alert.js.

@cvrebert
Copy link
Collaborator

@Chaser324 Please file a new separate issue.

@@ -139,6 +139,7 @@
this.$element.trigger(e)

if (e.isDefaultPrevented()) return
var that = this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semicolon 😢

@fat
Copy link
Member

fat commented Dec 24, 2013

im ok with this… would be rad if you'd add a test though

@lukaszfiszer
Copy link
Contributor Author

I wanted to add some tests, but got blocked on one issue... Other tests are notoriously setting $.support.transition = false globally (like here ) without restoring the original value. With transitions disabled, I cannot test my fix.

Do you see any other way of doing it other than going through all other tests and making sure that they restore $.support.transition properly?

@fat
Copy link
Member

fat commented Dec 24, 2013

can't you just set $.support.transition = true in your test?

@lukaszfiszer
Copy link
Contributor Author

not really - $.support.transition is an complex object created by transition.js. I don't mind going through all test files and make sure that they restore it's original value (possibly with qunit module's setup and teardown callbacks) but that probably should be done in a separate PR.

@fat fat merged commit 0adb4e3 into twbs:master Dec 26, 2013
@fat
Copy link
Member

fat commented Dec 26, 2013

ah yeah dur – probably worth looking into that in the future

@crax
Copy link

crax commented Mar 25, 2014

All,

As this bug has been fixed, how can we set custom position on popover or tooltip like codes http://www.bootply.com/124485. ( it works find at 3.0.3, but not 3.1.0)

The problem now is if we change position by css after transition end(as the behavior shown.bs now), user will see the position changing progress on the view, that's not good experience.

Thanks for any help

@cvrebert
Copy link
Collaborator

@crax Use the template option of Popover to add a custom CSS class (or, blech, an inline style attribute) to the popover HTML and set the position that way?

@crax
Copy link

crax commented Mar 25, 2014

@cvrebert thanks for you reply. template can works with the static content very well, but as dynamic html content in the popover, i think it may need the codes like:

$('.popover').css('top',parseInt($('.popover').css('top')) + 22 + 'px')

btw, I'm adding a 'showing.bs' between 'shown.bs' and 'show' to temporarily let it work now.

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

Successfully merging this pull request may close these issues.

None yet

5 participants