1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 06:44:35 +02:00

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 <xhmikosr@gmail.com>
This commit is contained in:
Rohit Sharma
2021-02-04 01:07:25 +05:30
committed by GitHub
parent a1bb65ef49
commit 217d84d6b2
6 changed files with 24 additions and 22 deletions

View File

@@ -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

View File

@@ -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;