-
Notifications
You must be signed in to change notification settings - Fork 842
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
Fix tooltip re-position after content resize & respect scroll bars #936
Fix tooltip re-position after content resize & respect scroll bars #936
Conversation
@@ -371,7 +371,7 @@ describe('popover_positioning', () => { | |||
|
|||
// give the container limited space on both left and top, forcing to bottom-right | |||
const container = document.createElement('div'); | |||
container.getBoundingClientRect = () => makeBB(100, 300, 768, 30); | |||
container.getBoundingClientRect = () => makeBB(50, 300, 768, 30); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is in response to buffer
now being used to compute fit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really awesome man! Nice job fixing this. I found one bug though. Horizontal centering looks fine if there are scrollbars visible, but if there aren't then it looks off-center (Chrome, OS X):
Also, I somehow managed to break things really badly by changing the size of the container element. Here's a screenshot showing the bottom tooltip, but the others are also fubared:
I am able to reproduce those issues that @cjcenizal found. Here are some more details. The first one seems to have to only occur when the page reaches it's max-width. Here you can see without scrollbars it's still fine but the screen is smaller than the max-width. And here you can see that once it's reached the max-width the positioning becomes slightly off. The second one also seems to have to do with the max-width on the page. Here are two screenshots of giant width on the guide, one with the max-width and the other without. |
@cchaos @cjcenizal tooltip creation now configured to avoid creating scrollbars while determining tooltip placement, this fixes the slightly-misaligned tooltip when no scrollbar is visible. The second problem where the arrow and tooltip are separated is caused by the relationship between the anchor, tooltip, and page body. If you force the anchor to be rendered outside of the page body's bounds (by, saying, giving |
I can't think of a time when we'd need this. The body should be the visible page. At least that's how we've been using it. I think we're OK not worrying too much about this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing these!
fast follow for #924
EuiTooltip
did not clear its previous knowledge of the tooltip content's size so a window resize & re-hover of the anchor would cause the new tooltip to be influenced by the previous instance's positioningbuffer
into account when calculating the content's fit value@cchaos would you mind testing the visuals again to see if you can find any circumstances where tooltip breaks / is malformed?