Skip to content

Commit 28016d3

Browse files
web-padawanclaude
andauthored
fix: mirror overflow chip stack and remove button in RTL (#12951)
## Description Related to #12950 In RTL, the overflow chip of the multi-select combo box reserves space for its stacked lines with `margin-inline-start`, but the lines were offset with the physical `left`, so they were drawn on the wrong side: inside the chip in base styles and Aura, over the neighbour chip in Lumo. The remove button was nudged with a physical `translate` and overlapped the label. - Replaced `left` with `inset-inline-start` for the `::before` and `::after` lines of the overflow chip in base styles and Lumo - Replaced `border-left` with `border-inline-start` in the Lumo chip styles - Mirrored the remove button `translate` in RTL in the base chip styles - Added a visual test with an overflow chip in RTL for base styles, Lumo and Aura - LTR baselines are unchanged ## Type of change - Bugfix ## How to test 1. Open `dev/multi-select-combo-box.html` and set `dir="rtl"` on `<html>` 2. Select enough items for the overflow chip to show with a count of 3 or more 3. The stacked lines appear on the right side of the overflow chip, in the gap before the field edge, and the remove button has a gap to the label 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 8449a65 commit 28016d3

9 files changed

Lines changed: 68 additions & 5 deletions

File tree

‎packages/multi-select-combo-box/src/styles/vaadin-multi-select-combo-box-chip-base-styles.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export const multiSelectComboBoxChipStyles = css`
5252
translate: 25%;
5353
}
5454
55+
:host(:dir(rtl)) [part='remove-button'] {
56+
translate: -25%;
57+
}
58+
5559
[part='remove-button']::before {
5660
content: '';
5761
display: block;
@@ -90,11 +94,11 @@ export const multiSelectComboBoxChipStyles = css`
9094
}
9195
9296
:host([slot='overflow'])::before {
93-
left: calc(-4px - var(--vaadin-chip-border-width, 1px));
97+
inset-inline-start: calc(-4px - var(--vaadin-chip-border-width, 1px));
9498
}
9599
96100
:host([slot='overflow'])::after {
97-
left: calc(-8px - var(--vaadin-chip-border-width, 1px));
101+
inset-inline-start: calc(-8px - var(--vaadin-chip-border-width, 1px));
98102
}
99103
100104
:host([count='2']) {

‎packages/multi-select-combo-box/test/visual/aura/multi-select-combo-box.test.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ describe('multi-select-combo-box', () => {
7070
});
7171
});
7272

73+
describe('RTL', () => {
74+
before(() => {
75+
document.documentElement.setAttribute('dir', 'rtl');
76+
});
77+
78+
after(() => {
79+
document.documentElement.removeAttribute('dir');
80+
});
81+
82+
beforeEach(() => {
83+
element.style.width = '250px';
84+
element.selectedItems = ['Apple', 'Banana', 'Lemon', 'Pear'];
85+
});
86+
87+
it('overflow', async () => {
88+
await visualDiff(div, 'selected-overflow-rtl');
89+
});
90+
});
91+
7392
describe('auto expand', () => {
7493
beforeEach(() => {
7594
element.selectedItems = [...element.items];
3.53 KB
Loading
4.05 KB
Loading

‎packages/multi-select-combo-box/test/visual/base/multi-select-combo-box.test.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,26 @@ describe('multi-select-combo-box', () => {
107107
});
108108
});
109109

110+
describe('RTL', () => {
111+
before(() => {
112+
document.documentElement.setAttribute('dir', 'rtl');
113+
});
114+
115+
after(() => {
116+
document.documentElement.removeAttribute('dir');
117+
});
118+
119+
beforeEach(async () => {
120+
element.style.width = '250px';
121+
element.selectedItems = ['Apple', 'Banana', 'Lemon', 'Pear'];
122+
await nextResize(element);
123+
});
124+
125+
it('overflow', async () => {
126+
await visualDiff(div, 'selected-overflow-rtl');
127+
});
128+
});
129+
110130
describe('auto expand', () => {
111131
beforeEach(() => {
112132
element.selectedItems = [...element.items];
1.99 KB
Loading

‎packages/multi-select-combo-box/test/visual/lumo/multi-select-combo-box.test.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,26 @@ describe('multi-select-combo-box', () => {
128128
});
129129
});
130130

131+
describe('RTL', () => {
132+
before(() => {
133+
document.documentElement.setAttribute('dir', 'rtl');
134+
});
135+
136+
after(() => {
137+
document.documentElement.removeAttribute('dir');
138+
});
139+
140+
beforeEach(async () => {
141+
element.style.width = '250px';
142+
element.selectedItems = ['Apple', 'Banana', 'Lemon', 'Pear'];
143+
await nextResize(element);
144+
});
145+
146+
it('overflow', async () => {
147+
await visualDiff(div, 'selected-overflow-rtl');
148+
});
149+
});
150+
131151
describe('auto expand', () => {
132152
beforeEach(() => {
133153
element.selectedItems = [...element.items];
1.69 KB
Loading

‎packages/vaadin-lumo-styles/src/components/multi-select-combo-box-chip.css‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@
4545
content: '';
4646
width: 100%;
4747
height: 100%;
48-
border-left: calc(var(--lumo-space-s) / 4) solid var(--lumo-contrast-30pct);
48+
border-inline-start: calc(var(--lumo-space-s) / 4) solid var(--lumo-contrast-30pct);
4949
border-radius: var(--lumo-border-radius-s);
5050
}
5151

5252
:host([slot='overflow'])::before {
53-
left: calc(-1 * var(--lumo-space-s) / 2);
53+
inset-inline-start: calc(-1 * var(--lumo-space-s) / 2);
5454
}
5555

5656
:host([slot='overflow'])::after {
57-
left: calc(-1 * var(--lumo-space-s));
57+
inset-inline-start: calc(-1 * var(--lumo-space-s));
5858
}
5959

6060
:host([count='2']) {

0 commit comments

Comments
 (0)