Skip to content

Commit

Permalink
fix(menu-button): fix multible button alignment (eBay#1849)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuLaValva authored and agliga committed Sep 21, 2022
1 parent ecb3c02 commit 55169c4
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 15 deletions.
16 changes: 13 additions & 3 deletions dist/combobox/combobox.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ span.combobox {
.combobox__options--fix-width[role="listbox"] {
width: 100%;
}
.combobox__options--reverse[role="listbox"] {
right: 0;
}
.combobox__listbox {
background-color: var(--combobox-listbox-background-color, var(--color-background-primary));
border-color: var(--combobox-listbox-border-color, var(--color-stroke-default));
Expand All @@ -28,6 +25,7 @@ span.combobox {
box-shadow: var(--combobox-listbox-box-shadow, var(--dropdown-box-shadow));
box-sizing: border-box;
display: none;
left: 0;
max-height: 400px;
min-width: 100%;
overflow-y: auto;
Expand All @@ -36,6 +34,18 @@ span.combobox {
width: auto;
z-index: 2;
}
[dir="rtl"] .combobox__listbox {
left: unset;
right: 0;
}
.combobox__listbox--reverse {
left: unset;
right: 0;
}
[dir="rtl"] .combobox__listbox--reverse {
left: 0;
right: unset;
}
.combobox__option[role^="option"] {
background-color: transparent;
border-style: solid;
Expand Down
5 changes: 5 additions & 0 deletions dist/listbox-button/listbox-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ div.listbox-button__listbox {
box-shadow: var(--listbox-button-listbox-box-shadow, var(--dropdown-box-shadow));
box-sizing: border-box;
display: none;
left: 0;
max-height: 400px;
min-width: 100%;
overflow-y: auto;
Expand All @@ -28,6 +29,10 @@ div.listbox-button__listbox {
width: auto;
z-index: 2;
}
[dir="rtl"] div.listbox-button__listbox {
left: unset;
right: 0;
}
button.expand-btn[aria-expanded="true"] ~ div.listbox-button__listbox,
.listbox-button button.btn[aria-expanded="true"] ~ div.listbox-button__listbox {
display: block;
Expand Down
9 changes: 8 additions & 1 deletion dist/menu-button/menu-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
box-shadow: var(--menu-button-menu-box-shadow, var(--dropdown-box-shadow));
box-sizing: border-box;
display: none;
left: 0;
max-height: 400px;
min-width: 100%;
overflow-y: auto;
Expand All @@ -22,6 +23,11 @@
z-index: 2;
outline: 0;
}
[dir="rtl"] .menu-button__menu,
[dir="rtl"] .fake-menu-button__menu {
left: unset;
right: 0;
}
span.menu-button__button,
span.fake-menu-button__button {
display: inline-block;
Expand Down Expand Up @@ -189,12 +195,13 @@ div.menu-button__item--badged[role^="menuitem"] .badge {
}
.menu-button__menu--reverse,
.fake-menu-button__menu--reverse {
left: unset;
right: 0;
}
[dir="rtl"] .menu-button__menu--reverse,
[dir="rtl"] .fake-menu-button__menu--reverse {
left: 0;
right: inherit;
right: unset;
}
.menu-button__button[aria-expanded="true"] ~ .menu-button__menu,
.fake-menu-button__button[aria-expanded="true"] ~ .fake-menu-button__menu,
Expand Down
8 changes: 4 additions & 4 deletions src/less/combobox/combobox.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ span.combobox {
width: 100%;
}

.combobox__options--reverse[role="listbox"] {
right: 0;
}

.combobox__listbox {
.dropdown-base(combobox-listbox);
}

.combobox__listbox--reverse {
.dropdown-reverse(combobox-listbox-reverse);
}

.combobox__option[role^="option"] {
.listbox-option-base();
.dropdown-item-border-radius(combobox-listbox);
Expand Down
8 changes: 1 addition & 7 deletions src/less/menu-button/menu-button.less
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,7 @@ div.menu-button__item--badged[role^="menuitem"] .badge {

.menu-button__menu--reverse,
.fake-menu-button__menu--reverse {
right: 0;
}

[dir="rtl"] .menu-button__menu--reverse,
[dir="rtl"] .fake-menu-button__menu--reverse {
left: 0;
right: inherit;
.dropdown-reverse(menu-button-menu-reverse);
}

.menu-button__button[aria-expanded="true"] ~ .menu-button__menu,
Expand Down
16 changes: 16 additions & 0 deletions src/less/mixins/private/dropdown-mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,29 @@
.box-shadow-token(~"@{component}-box-shadow", dropdown-box-shadow);
box-sizing: border-box;
display: none;
left: 0;
max-height: 400px;
min-width: 100%;
overflow-y: auto;
position: absolute;
top: calc(100% + 4px);
width: auto;
z-index: 2;

[dir="rtl"] & {
left: unset;
right: 0;
}
}

.dropdown-reverse() {
left: unset;
right: 0;

[dir="rtl"] & {
left: 0;
right: unset;
}
}

.dropdown-item-border-radius(@component) {
Expand Down

0 comments on commit 55169c4

Please sign in to comment.