-
-
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
Tooltip layout wrong when elements outside of viewport #14195
Comments
This issue seems to be caused by the function
In this case, topEdgeOffset is negative, so a positive top offset is added to the tooltip, making it fit in screen space. I would be glad to fix the issue, if the project owners were so kind as to describe the expected behavior. Here's what I propose:
A nice to have would also be to dynamically reposition tooltips as the user scrolls, but that would be another issue. What do you think? |
Given the rounded edges of the Tooltip, adjusting the tooltips that don't fit can result in unpleasant "holes" between the arrow and the tooltip. I'll try to look into edb221a a bit more, but it seems to me that by default, the delta shouldn't be applied unless the viewport is not the body, and if the delta is applied, the arrow should also be adjusted, which is not currently the case. |
You don't need to reposition tooltips when the user scrolls, actually only if the user zooms in/out. |
/cc @fat about the questions/proposal of @ericmartel |
Thanks for the cc I looked a bit more at it last night, and the current implementation of the viewport is broken. I'll add unit tests to first bug the fact that the arrows are not placed properly when the tooltip is moved by the viewport and then start by fixing this. Then, once I am sure both the arrow and the tooltip are behaving in the same way, I'll take scrolling into account in the viewport. I don't believe anymore partially hidden tooltips should be repositionned dynamically, after reading some of the tests, the viewport addition seems to be more to handle things such as padding in containers. |
Good morning! Maybe I'm just confused because I'm new to the project / client side JS, but I have a hard time understanding the expected behavior of edb221a While the documentation says the viewport is another element, there are a lot of assumptions with I made some local changes to make it appropriately reposition the tooltip based on another element, but there's still some references to @fat / @cvrebert : do you guys know what's the expected behavior of the viewport / viewport padding in the Tooltip library? Do we want to a) prevent the tooltip from touching the viewport element by n pixels or b) do we want to keep the tooltip from touching the edge of the browser by n pixels? Either way, the current code was taking scrolling into account, which seems like a bad idea. If you guys want a quick chat, you can easily reach me on twitter: @emartelai Thanks |
@ericmartel Maybe the discussions in #11593 and #12328 will give you more insight. And the tooltip viewport example might also be helpful. |
@hnrch02 Thanks! so a) it is! Using the Thanks! |
@ericmartel Looking forward to your PR! |
Bootstraps creates the arrows through the CSS3 pseudo classes, which don't scale well and you get these offset in some cases, for example on some zoom levels. |
Sauce Labs, or local machines/devices, or local VMs (for IE, typically the gratis modern.ie VMs) |
@ericmartel where can i download the fix you made or do I have to wait for the next release? |
@Legends if you know how to build a bootstrap distribution (its explained in the Getting Started guide from getbootstrap.com), you could build this branch: https://github.com/ericmartel/bootstrap/tree/tooltip_positioning_14195 Keep in mind it's a development branch, it's possible that other bugs are in there, this is not an official release. Thanks! |
@ericmartel Hi Eric, I've downloaded the zip from Try to zoom in here: |
@Legends This version of bootstrap.js does not contain the compiled changes in tooltip.js. You have to build the thing using I also didn't test zooming... I can look once I get back home if the zoom is properly handled by my implementation! |
@ericmartel FWIW, zooming tends to break things generally (as mentioned in our compatibility docs) (and I think this plugin in particular), so don't stress too much if zooming breaks your code. |
@ericmartel Zooming should not break the layout. |
@Legends The relevant section here is http://getbootstrap.com/getting-started/#support-browser-zooming |
@ericmartel thanks for all the work on this as chris said, don't worry about zooming or scrolling I think the viewport element is supposed to be used to constrain auto positioning. So for example, if your tooltip is detecting if it is overflowing a boundary it will react. This should 99% of the time be the window… that pr in theory (i believe) allows you to set the boundary element to a different element |
The getPosition function was simplified with a new function, getViewportBounds, was added to specifically tackle the cases where we’re looking for the viewport bounds. 'absolute' and 'fixed' tooltips are now matched against the screen where other ones are made to fit inside the viewport element. Fixes #14195 Closes #14226
Punting as a won't fix—v4 includes a new positioning library for our affix, tooltips, and popovers. |
look here:
http://jsbin.com/yalohofo/1/
The layout of the tooltips gets screwed up, if the tooltips are created when outside of the viewport !
The text was updated successfully, but these errors were encountered: