-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
New insert strategy for tooltip breaks tooltips/popovers on table cells #5687
Comments
It fixes a load of z-index issues + when a modal is closed an open popover did not hide |
The change also causes problems, when using a tooltip inside an element with overflow:hidden & position:relative. |
http://jsfiddle.net/mvgRC/12/ demonstrates td issues with insertAfter |
Ive been thinking and concluded that its better to wrap text with a span and add the popover there instead of putting popovers on btn groups, tds etc. Or? The new insert strategy is way more powerful after all. |
@andriijas that solution seems to work with <td>s, but not for the btn-group or @hpbuniat's problem |
@Yohn that is a bug for sure! |
I think the new insert strategy needs some tweaking: now it uses insertAfter if table, input: --> .insertAfter |
@demike that does make sense, and I could see it work with the btn-groups but then the tooltip/popover will be taking on the styles of its parent element. maybe it would be good to decide where it gets appended to manually with an option.. something like .popover({
appendTo: $('body')
}) |
i would be happy with a by default it inserts after the element but with a config option it attaches it to whatever element you specify. like the old way appendTo((element)?element:body) type thing options for html api
for javascript
parent would then be as it currently is (in 2.2.~) and is the default if you specify the container it then uses that container if it finds it if not then default back to parent as it is now
could do something like
i would recomend an array type thing tho.. insertAfter = element, self that way you can control which to make use of depending on the option used |
@WilliamStam I like that approach. Woudl be awesome if you could make a pull request and maybe they will merge it :) |
@andriijas no pull requests are being accepted if they dont include tests (i dont know how to make the tests). i also seriously dont know how to code like they have in BS. lemme see if i can do something with it tho |
@WilliamStam the tests are pretty easy, they have examples within the js/tests/unit/ directory that you can follow.. just add the changes to your own test at the bottom and add it to the pull request. I'm also thinking about giving this one a shot. |
@Yohn just a thought... if the whole appendTo thing is cause of the modals then why not do a
|
I dont think we should put anything within the tooltip plugin referring to the modals itself but that might be a way to actually get it to work correctly without having to use the option for a container.. heres how the tip got shown in the previous version $tip
.remove()
.css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body) 2.2.2 version $tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.insertAfter(this.$element) Id have to do some more thinking about how it should go, @fat or @markdotto might have a better idea though we also need to get the |
i have a fix.. just trying to figure out how to do the tests... and needs a bit of testing i suppose
|
added a container option so either use the html data api ``` data-container="parent" data-container="body" data-container="#some_element" ``` or the javascript ``` { container: "body" } ``` added 3 tests to the tool tip aswell to test if the tooltip is being added to the right places
http://puu.sh/1nsCx test working |
ok would somone be so kind as to explain why i get a build failed? then it when clicking details it shows me
bleh.. i also found out the details its ment to show shows some other project instead of this 1 in opera... it works in chrome tho.. opera: http://puu.sh/1nsGX i have to go,, so if somone else can get it to work then cool.. do a pull request to them. basicaly just added the tests and the switch i posted earlier |
the tests i added.
|
k pull request done and passing. lets see if BS accepts it. @Yohn made this fiddle (incase you not following the discussion on the pull request) http://jsfiddle.net/JMskU/17/ shows that the fix will work (hopefully) |
@ajbeaven to follow up with the other thread - I really dont know why they took the "inside" option out.. it had to be with the fix for the modals not displaying the tooltips / popovers..
and if no container if selected it would be appended after the element that called the tooltip |
@ajbeaven I believe they did have a higher z-index, but for some reason it wasnt working. I'm sure @fat or @markdotto would be able to answer that one better.. |
i had problems with the modal closing but the tooltips / popovers staying visible. saw something similar here as well. suppose its that as well as the zindex thing? |
For what its worth this change to tooltips and popovers should probably have been put in 3.0 which is backwards incompatible. However its in place and I believe the new insert strategy is far superior to the old one. Just wrap your stuff with a span and add the tooltip/popover there instead. |
you still have the issue of overflow hidden / adding a tooltip to for instance the small in a
it applies the h style to the popover.. so as to "superior"... i dont know so much |
As mentioned, we changed this to fix z-indexing (the api stayed the same… so it didn't warrant a 3.0.0 release). If you want to add a tooltip to a table cell - just wrap in a span/div and you should be all set (apologies on that though, might be worth adding a note to the docs about that). If you guys want to open a separate issue for the button problem, or anything else please do. thanks! |
I don't agree with closing this issue. Wrapping popover in span / div does not solve it. Table cell has padding and popover arrow points to some place inside cell. This can be fixed with css by removing padding from cell, but all this stuff seems to be hackish. I think that best way is to allow us to choose popover container. Single insert strategy does not work everywhere. |
Please, can someone explain to me how to make a tooltip work on a table/td, maybe w/ a jsfiddle ? I may be stupid but I don't get that div wrapping fix. My app is broken for weeks now ... Edit: nevermind, figured it out. You need to wrap all your td content in a div and move the tooltip data in the div (and update your jquery selector). |
I'm sorry, but this problem should never have been introduced in the first place. "Just wrap your TD content in a div" is fine as long as you have control over the content. But if you're using something like the KendoUI Grid, then you have no control whatsoever. Now I get to diff the two files and try to roll the Popover backward while keeping everything else. Change for the sake of change is not always a bad thing... what was wrong with the way 2.1 did it? |
what about the
i have a project that uses absolute positioning the "new" way ends up in a lot of popovers that get cut off. being able to define its container is definately the better option. recommendation: the default does the new changes, but at least give us an option to set parent container |
heres what I have so far with setting a container for the tooltips / popovers -- http://jsfiddle.net/R23KB/4/ the problem with them getting cut off by the sides, header, and footer also applies to dropdown menus within modal-body but as a side note, I do like old way we inserted the tooltips into the page with |
I just got bitten by this one as well, cut-off tooltips now. Wrapping the content in a div or span wouldn't solve this. Also - although the API didn't change wasn't this still a backwards incompatible change as our previous code no longer works the same calling the same API functions? In which case according to semver it should have been a major version bump, right? |
@benatwork99 I can see that being a valid point, and since this thread is closed, I'd recommend bringing it up in a new issue if fat or mdo dont reply here |
http://jsfiddle.net/FRbhW/1/ |
@ProIcons -- http://jsfiddle.net/FRbhW/4/ You have to set the container option when you call |
Just to give a TL;DR for future readers: The solution as of v2.3.x is to set the $(...).tooltip({container: 'body'}); Or using a data-container="body" |
We found more bugs regarding popovers/tooltips in version 2.3.x, so reverted back to 2.2.2. For example, tooltips on the left appear over the element itself (http://twitter.github.io/bootstrap/javascript.html#tooltips) and the dynamic placement of the tip arrow when the element is in one of the right corners is broken (http://codepen.io/andrewgunn/pen/HlyGz). We also had an issue with the popover width being too small (in some scenarios) making it narrow, tall and appear off screen. As a result, we can't take advantage of the |
the solution is this: <td class="Sale_td">
<div data-trigger="focus" data-toggle="popover">
[....]
</div>
</td> |
This change breaks the possibilities of having tooltips and popovers on table cells.
88b1e44#L3L1086
Please let me know the reasoning behind the change of strategy so that I get an understanding of If I may have to change my code.
Thanks
The text was updated successfully, but these errors were encountered: