diff options
| author | Rohit Sharma <[email protected]> | 2021-02-04 01:07:25 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-03 21:37:25 +0200 |
| commit | 217d84d6b25c44ea9791e4ca760a35e46f2e0653 (patch) | |
| tree | 5d2f0da60cecad1e7eb6c0e9387677e6fa50a5f6 /scss | |
| parent | a1bb65ef49d1373f224e228e67112a675b390720 (diff) | |
| download | bootstrap-217d84d6b25c44ea9791e4ca760a35e46f2e0653.tar.xz bootstrap-217d84d6b25c44ea9791e4ca760a35e46f2e0653.zip | |
Remove the initial margin from dropdown/popover in favor of Popper (#32524)
* Remove the margin from dropdown in favor of Popper
- Set the default margin to 0 for dropdowns (To remove the Popper's warning)
- Set the required offset in dropdown's defaults
* Remove the margin from the popover component
Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'scss')
| -rw-r--r-- | scss/_dropdown.scss | 27 | ||||
| -rw-r--r-- | scss/_popover.scss | 12 |
2 files changed, 20 insertions, 19 deletions
diff --git a/scss/_dropdown.scss b/scss/_dropdown.scss index 594c06399..f659ddc77 100644 --- a/scss/_dropdown.scss +++ b/scss/_dropdown.scss @@ -22,7 +22,7 @@ display: none; // none by default, but block on "open" of the menu min-width: $dropdown-min-width; padding: $dropdown-padding-y $dropdown-padding-x; - margin: $dropdown-spacer 0 0; // override default ul + margin: 0; // Override default margin of ul @include font-size($dropdown-font-size); color: $dropdown-color; text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer) @@ -68,8 +68,11 @@ .dropdown-menu { top: auto; bottom: 100%; - margin-top: 0; - margin-bottom: $dropdown-spacer; + + &.show:not([data-popper-placement]) { + margin-top: 0; + margin-bottom: $dropdown-spacer; + } } .dropdown-toggle { @@ -82,8 +85,11 @@ top: 0; right: auto; left: 100%; - margin-top: 0; - margin-left: $dropdown-spacer; + + &.show:not([data-popper-placement]) { + margin-top: 0; + margin-left: $dropdown-spacer; + } } .dropdown-toggle { @@ -99,8 +105,11 @@ top: 0; right: 100%; left: auto; - margin-top: 0; - margin-right: $dropdown-spacer; + + &.show:not([data-popper-placement]) { + margin-top: 0; + margin-right: $dropdown-spacer; + } } .dropdown-toggle { @@ -174,6 +183,10 @@ .dropdown-menu.show { display: block; + + &:not([data-popper-placement]) { + margin-top: $dropdown-spacer; + } } // Dropdown section headers diff --git a/scss/_popover.scss b/scss/_popover.scss index 3778f6ff7..a55555e2e 100644 --- a/scss/_popover.scss +++ b/scss/_popover.scss @@ -35,9 +35,6 @@ } .bs-popover-top { - // Overrule margin set by popper.js - margin-bottom: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important - > .popover-arrow { bottom: subtract(-$popover-arrow-height, $popover-border-width); @@ -56,9 +53,6 @@ } .bs-popover-end { - // Overrule margin set by popper.js - margin-left: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important - > .popover-arrow { left: subtract(-$popover-arrow-height, $popover-border-width); width: $popover-arrow-height; @@ -79,9 +73,6 @@ } .bs-popover-bottom { - // Overrule margin set by popper.js - margin-top: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important - > .popover-arrow { top: subtract(-$popover-arrow-height, $popover-border-width); @@ -112,9 +103,6 @@ } .bs-popover-start { - // Overrule margin set by popper.js - margin-right: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important - > .popover-arrow { right: subtract(-$popover-arrow-height, $popover-border-width); width: $popover-arrow-height; |
