Skip to content

Commit 2cd5e9c

Browse files
authored
fix(dropdown): left and right menu positioning regression
This PR fixes the first level of simple dropdown inside the right menu was cropped and out of the screen when the parent menu item has short text, and the dropdown doesn't specify the class name `left`. To avoid this, all dropdown inside the right menu will be forced to appear leftward by default. The dropdown can also appear leftward or rightward by having `left` or `right` class name. This PR also fix the dropdown inside the buttons which are positioned incorrectly.
1 parent 4187f1f commit 2cd5e9c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/definitions/modules/dropdown.less

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,10 @@
318318
}
319319

320320
/* Automatically float dropdown menu right on last menu item */
321-
.ui.menu .right.menu .dropdown:last-child .menu:not(.left),
322-
.ui.menu .right.dropdown.item .menu:not(.left),
323-
.ui.buttons > .ui.dropdown:last-child .menu:not(.left) {
321+
.ui.menu .right.menu .dropdown:last-child > .menu:not(.left),
322+
.ui.menu .right.dropdown.item > .menu:not(.left),
323+
.ui.buttons > .ui.dropdown:last-child > .menu:not(.left) {
324+
left: auto;
324325
right: 0;
325326
}
326327

@@ -1096,7 +1097,7 @@ select.ui.dropdown {
10961097

10971098
.ui.dropdown > .left.menu .menu,
10981099
.ui.dropdown .menu .left.menu {
1099-
left: auto !important;
1100+
left: auto;
11001101
right: 100%;
11011102
margin: @leftSubMenuMargin !important;
11021103
border-radius: @leftSubMenuBorderRadius !important;
@@ -1325,6 +1326,13 @@ select.ui.dropdown {
13251326
left: 100%;
13261327
opacity: 1;
13271328
}
1329+
.ui.simple.dropdown > .menu > .item:active > .left.menu,
1330+
.ui.simple.dropdown .menu .item:hover > .left.menu,
1331+
.right.menu .ui.simple.dropdown > .menu > .item:active > .menu:not(.right),
1332+
.right.menu .ui.simple.dropdown > .menu .item:hover > .menu:not(.right) {
1333+
left: auto;
1334+
right: 100%;
1335+
}
13281336
& when (@variationDropdownDisabled) {
13291337
.ui.simple.disabled.dropdown:hover .menu {
13301338
display: none;

src/themes/default/modules/dropdown.variables

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
@subMenuLeft: 100%;
6969
@subMenuRight: auto;
7070
@subMenuDistanceAway: -0.5em;
71-
@subMenuMargin: 0 0 0 @subMenuDistanceAway;
71+
@subMenuMargin: 0 @subMenuDistanceAway;
7272
@subMenuBorderRadius: @borderRadius;
7373
@subMenuZIndex: 21;
7474

0 commit comments

Comments
 (0)