Skip to content

Commit

Permalink
fix!: do not override dir attribute on the overlay to rely on DirMixin (
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Aug 21, 2024
1 parent 451c328 commit f18cc10
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ snapshots["vaadin-avatar-group opened default"] =

snapshots["vaadin-avatar-group opened overlay"] =
`<vaadin-avatar-group-overlay
dir="ltr"
id="overlay"
no-vertical-overlap=""
start-aligned=""
Expand Down Expand Up @@ -187,7 +186,6 @@ snapshots["vaadin-avatar-group opened overlay"] =
snapshots["vaadin-avatar-group opened overlay class"] =
`<vaadin-avatar-group-overlay
class="avatar-group-overlay custom"
dir="ltr"
id="overlay"
no-vertical-overlap=""
start-aligned=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ snapshots["vaadin-combo-box host opened default"] =

snapshots["vaadin-combo-box host opened overlay"] =
`<vaadin-combo-box-overlay
dir="ltr"
id="overlay"
no-vertical-overlap=""
opened=""
Expand Down Expand Up @@ -414,7 +413,6 @@ snapshots["vaadin-combo-box host opened overlay shadow"] =
snapshots["vaadin-combo-box host opened overlay class"] =
`<vaadin-combo-box-overlay
class="combo-box-overlay custom"
dir="ltr"
id="overlay"
no-vertical-overlap=""
opened=""
Expand Down Expand Up @@ -452,7 +450,6 @@ snapshots["vaadin-combo-box host opened overlay class"] =

snapshots["vaadin-combo-box host opened theme overlay"] =
`<vaadin-combo-box-overlay
dir="ltr"
id="overlay"
no-vertical-overlap=""
opened=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
export const snapshots = {};

snapshots["context-menu items"] =
`<vaadin-context-menu-overlay
dir="ltr"
opened=""
>
`<vaadin-context-menu-overlay opened="">
<vaadin-context-menu-list-box
aria-orientation="vertical"
role="menu"
Expand Down Expand Up @@ -62,7 +59,6 @@ snapshots["context-menu items"] =

snapshots["context-menu items nested"] =
`<vaadin-context-menu-overlay
dir="ltr"
modeless=""
opened=""
start-aligned=""
Expand Down Expand Up @@ -102,7 +98,6 @@ snapshots["context-menu items nested"] =
snapshots["context-menu items overlay class"] =
`<vaadin-context-menu-overlay
class="context-menu-overlay custom"
dir="ltr"
opened=""
>
<vaadin-context-menu-list-box
Expand Down Expand Up @@ -162,7 +157,6 @@ snapshots["context-menu items overlay class"] =
snapshots["context-menu items overlay class nested"] =
`<vaadin-context-menu-overlay
class="context-menu-overlay custom"
dir="ltr"
modeless=""
opened=""
start-aligned=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ snapshots["vaadin-date-picker host value"] =

snapshots["vaadin-date-picker host opened overlay"] =
`<vaadin-date-picker-overlay
dir="ltr"
id="overlay"
opened=""
restore-focus-on-close=""
Expand Down Expand Up @@ -451,7 +450,6 @@ snapshots["vaadin-date-picker host opened overlay"] =
snapshots["vaadin-date-picker host opened overlay class"] =
`<vaadin-date-picker-overlay
class="custom date-picker-overlay"
dir="ltr"
id="overlay"
opened=""
restore-focus-on-close=""
Expand Down Expand Up @@ -613,7 +611,6 @@ snapshots["vaadin-date-picker host opened overlay class"] =

snapshots["vaadin-date-picker host opened overlay theme"] =
`<vaadin-date-picker-overlay
dir="ltr"
id="overlay"
opened=""
restore-focus-on-close=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const datePickerOverlay = css`
border-radius: 0 4px 4px;
}
:host([dir='ltr']:not([fullscreen])[end-aligned]) [part='overlay'],
:host(:not([dir='rtl']):not([fullscreen])[end-aligned]) [part='overlay'],
:host([dir='rtl']:not([fullscreen])[start-aligned]) [part='overlay'] {
border-radius: 4px 0 4px 4px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ snapshots["vaadin-date-time-picker host error"] =
snapshots["vaadin-date-time-picker host overlay class date-picker"] =
`<vaadin-date-picker-overlay
class="custom date-time-picker-overlay"
dir="ltr"
id="overlay"
opened=""
restore-focus-on-close=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ snapshots["menu-bar basic"] =

snapshots["menu-bar overlay"] =
`<vaadin-menu-bar-overlay
dir="ltr"
opened=""
right-aligned=""
start-aligned=""
Expand Down Expand Up @@ -95,7 +94,6 @@ snapshots["menu-bar overlay"] =
snapshots["menu-bar overlay class"] =
`<vaadin-menu-bar-overlay
class="custom menu-bar-overlay"
dir="ltr"
opened=""
right-aligned=""
start-aligned=""
Expand Down
1 change: 0 additions & 1 deletion packages/overlay/src/vaadin-overlay-position-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export const PositionMixin = (superClass) =>
this.__margins[propName] = parseInt(computedStyle[propName], 10);
});
}
this.setAttribute('dir', computedStyle.direction);

this._updatePosition();
// Schedule another position update (to cover virtual keyboard opening for example)
Expand Down
12 changes: 4 additions & 8 deletions packages/overlay/test/position-mixin.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,9 @@ describe('position mixin', () => {
});

it('should align right edges with right-to-left', async () => {
overlay.opened = false;
await nextUpdate(overlay);
document.dir = 'rtl';
overlay.opened = true;
await nextUpdate(overlay);
await nextRender();
updatePosition();
expectEdgesAligned(RIGHT, RIGHT);
});

Expand Down Expand Up @@ -483,11 +481,9 @@ describe('position mixin', () => {
});

it('should align left edges with right-to-left', async () => {
overlay.opened = false;
await nextUpdate(overlay);
document.dir = 'rtl';
overlay.opened = true;
await nextUpdate(overlay);
await nextRender();
updatePosition();
expectEdgesAligned(LEFT, LEFT);
});

Expand Down
2 changes: 0 additions & 2 deletions packages/select/test/dom/__snapshots__/select.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ snapshots["vaadin-select host opened default"] =

snapshots["vaadin-select host opened overlay"] =
`<vaadin-select-overlay
dir="ltr"
opened=""
start-aligned=""
top-aligned=""
Expand Down Expand Up @@ -340,7 +339,6 @@ snapshots["vaadin-select host opened overlay"] =
snapshots["vaadin-select host opened overlay class"] =
`<vaadin-select-overlay
class="custom select-overlay"
dir="ltr"
opened=""
start-aligned=""
top-aligned=""
Expand Down
2 changes: 0 additions & 2 deletions packages/tooltip/test/dom/__snapshots__/tooltip.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ snapshots["vaadin-tooltip end-bottom"] =

snapshots["vaadin-tooltip opened overlay"] =
`<vaadin-tooltip-overlay
dir="ltr"
hidden=""
modeless=""
no-vertical-overlap=""
Expand All @@ -198,7 +197,6 @@ snapshots["vaadin-tooltip opened overlay"] =
snapshots["vaadin-tooltip opened overlay class"] =
`<vaadin-tooltip-overlay
class="custom tooltip-overlay"
dir="ltr"
hidden=""
modeless=""
no-vertical-overlap=""
Expand Down

0 comments on commit f18cc10

Please sign in to comment.