-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Update Popper to v2.x #31178
Update Popper to v2.x #31178
Conversation
add2a4f
to
6565759
Compare
Hi our @twbs/css-review team ❤️ Would you help me here ? I have some css issues on this migration |
Is this just a matter of setting the offset in popper?
What is this exactly? is it the alignment of the arrow? |
Hey folks, we tried to preemptively upgrade to popper v2 in react-bootstrap for bootstrap 4 and thought it might be helpful top share what we learned: tl;dr; Proper popper v2 support requires bigger CSS changes to the tooltip, popover, and dropdown menu The slightly longer version is that popper no longer considers margins when calculating offsets, which ius why the Popover and dropdown are positioned incorrectly. To fix, all distance should be set via the popper offset modifier. Another related consequence to this is that arrow positioning that depends on creating space via a padding (the tooltip) also doesn't work well anymore (maybe never). The issue there is that when using Popper docs and Tippy both avoid this problem by only using the offset modifier and offsetting the arrow relative to the container (e.g left ; -4px) None of this is particularly hard to fix BUT it has the consequence of needing config for arrow size available in JS, or doing some getComputedStyle shenanigans in a offset modifier (which does accept a function but doesn't pass in the actual popper element). |
I'd also add that I'd be happy to help out getting this in. Popper v2 is awesome and tiny |
@jquense We'll take any help you can give! Would love to get this included in Alpha 3! |
6565759
to
ec5d7b6
Compare
Rebased it, hopefully nothing broke :) |
1aef9d4
to
fb16dcc
Compare
This comment has been minimized.
This comment has been minimized.
d4f47b7
to
17830ce
Compare
17830ce
to
cd66e6d
Compare
cd66e6d
to
bba05f0
Compare
c3b0d48
to
047fc69
Compare
scss/_dropdown.scss
Outdated
|
||
// Reset positioning when positioned with Popper | ||
&[style] { | ||
right: auto; // TODO RTL? |
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 needs a check @ffoodd for RTL (and the whole PR)
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.
On the RTL side, this will be translated to left: auto
.
If this part is meant to reset initial positionning, maybe we should reset both sides? If so, it'll need #{"/* rtl:ignore */"}
as seen a few lines below.
Edit: in fact it seems to behaves as expected. Only the arrows aren't flipped.
e0b7537
to
de8cd00
Compare
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.
On the RTL part, arrows aren't flipped in RTL so there's something to tackle there.
After trying things out, I think .popover-arrow
should be processed by RTLCSS (meaning drop #{"/* rtl:ignore */"}
in every .bs-popover-* > .popover-arrow { … }
).
scss/_dropdown.scss
Outdated
|
||
// Reset positioning when positioned with Popper | ||
&[style] { | ||
right: auto; // TODO RTL? |
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.
On the RTL side, this will be translated to left: auto
.
If this part is meant to reset initial positionning, maybe we should reset both sides? If so, it'll need #{"/* rtl:ignore */"}
as seen a few lines below.
Edit: in fact it seems to behaves as expected. Only the arrows aren't flipped.
20436b4
to
b0b0efb
Compare
fallbackPlacement
->fallbackPlacements
breaking change?https://popper.js.org/docs/
but don't blindly replace them!)Fixes #29842
Preview: https://deploy-preview-31178--twbs-bootstrap.netlify.app/