Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
XhmikosR
d0de138afa
Merge branch 'main' into main-mc-popperfix 2020-12-18 18:36:43 +02:00
Martijn Cuppens
28ca7cb9fd Reset styles when popper is calculating position 2020-12-17 09:11:56 +01:00
2 changed files with 7 additions and 1 deletions

View file

@ -57,6 +57,7 @@ const CLASS_NAME_DROPUP = 'dropup'
const CLASS_NAME_DROPEND = 'dropend'
const CLASS_NAME_DROPSTART = 'dropstart'
const CLASS_NAME_NAVBAR = 'navbar'
const CLASS_NAME_POPPER_ACTIVE = 'popper-active'
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]'
const SELECTOR_FORM_CHILD = '.dropdown form'
@ -174,7 +175,12 @@ class Dropdown extends BaseComponent {
}
}
// The `.popper-active` class removes the `right` property in CSS
// This way popper can position the dropdown correctly
// We add it back after the calculations to get control over our positioning with our CSS again
this._menu.classList.add(CLASS_NAME_POPPER_ACTIVE)
this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig())
this._menu.classList.remove(CLASS_NAME_POPPER_ACTIVE)
}
// If this is a touch-enabled device we add extra

View file

@ -34,7 +34,7 @@
@include box-shadow($dropdown-box-shadow);
// Reset positioning when positioned with Popper
&[style] {
&.popper-active {
right: auto#{"/* rtl:ignore */"} !important; // stylelint-disable-line declaration-no-important
}
}