Skip to content

Commit

Permalink
refactor: replace [rtl] and [ltr] selectors with :dir (#3084)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Tommmaso Menga <[email protected]>
  • Loading branch information
dauriamarco and TomMenga authored Sep 18, 2024
1 parent 9c8fecc commit 164e3bc
Show file tree
Hide file tree
Showing 93 changed files with 20 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ snapshots["sbb-timetable-row renders defaultTrip Shadow DOM"] =
<sbb-card-button
data-action=""
data-button=""
dir="ltr"
role="button"
slot="action"
tabindex="0"
Expand Down Expand Up @@ -98,7 +97,6 @@ snapshots["sbb-timetable-row renders platform Shadow DOM"] =
<sbb-card-button
data-action=""
data-button=""
dir="ltr"
role="button"
slot="action"
tabindex="0"
Expand Down Expand Up @@ -198,7 +196,6 @@ snapshots["sbb-timetable-row renders bus strip Shadow DOM"] =
<sbb-card-button
data-action=""
data-button=""
dir="ltr"
role="button"
slot="action"
tabindex="0"
Expand Down Expand Up @@ -294,7 +291,6 @@ snapshots["sbb-timetable-row renders loading state Shadow DOM"] =
<sbb-card-badge
class="sbb-loading__badge"
color="charcoal"
dir="ltr"
role="text"
slot="badge"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ snapshots["sbb-accordion renders DOM"] =
data-button=""
data-size="l"
data-slot-names="unnamed"
dir="ltr"
id="sbb-expansion-panel-header-1"
role="button"
slot="header"
Expand Down Expand Up @@ -46,7 +45,6 @@ snapshots["sbb-accordion renders DOM"] =
data-button=""
data-size="l"
data-slot-names="unnamed"
dir="ltr"
id="sbb-expansion-panel-header-2"
role="button"
slot="header"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ snapshots["sbb-action-group renders renders DOM"] =
data-button=""
data-sbb-button=""
data-slot-names="unnamed"
dir="ltr"
role="button"
size="l"
tabindex="0"
Expand All @@ -26,7 +25,6 @@ snapshots["sbb-action-group renders renders DOM"] =
data-link=""
data-sbb-link=""
data-slot-names="unnamed"
dir="ltr"
href="https://github.com/sbb-design-systems/lyne-components"
icon-name="chevron-small-left-small"
icon-placement="start"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ snapshots["sbb-alert should render default properties Shadow DOM"] =
data-action=""
data-button=""
data-sbb-button=""
dir="ltr"
icon-name="cross-small"
negative=""
role="button"
Expand Down Expand Up @@ -133,7 +132,6 @@ snapshots["sbb-alert should render customized properties Shadow DOM"] =
data-link=""
data-sbb-link=""
data-slot-names="unnamed"
dir="ltr"
href="https://www.sbb.ch"
negative=""
rel="noopener"
Expand All @@ -158,7 +156,6 @@ snapshots["sbb-alert should render customized properties Shadow DOM"] =
data-action=""
data-button=""
data-sbb-button=""
dir="ltr"
icon-name="cross-small"
negative=""
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ snapshots["sbb-autocomplete-grid-button renders DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
icon-name="pie-small"
id="sbb-autocomplete-grid-button-1"
role="button"
Expand Down Expand Up @@ -35,7 +34,6 @@ snapshots["sbb-autocomplete-grid-button renders disabled DOM"] =
aria-disabled="true"
data-action=""
data-button=""
dir="ltr"
disabled=""
icon-name="pie-small"
id="sbb-autocomplete-grid-button-3"
Expand Down Expand Up @@ -65,7 +63,6 @@ snapshots["sbb-autocomplete-grid-button renders negative without icon DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
id="sbb-autocomplete-grid-button-5"
negative=""
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ snapshots["sbb-autocomplete-grid-cell renders DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
icon-name="pie-small"
id="sbb-autocomplete-grid-button-1"
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ snapshots["sbb-autocomplete-grid-row renders DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
icon-name="pie-small"
id="sbb-autocomplete-grid-button-1"
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const snapshots = {};
snapshots["sbb-autocomplete-grid Safari DOM"] =
`<sbb-autocomplete-grid
data-state="closed"
dir="ltr"
id="sbb-autocomplete-grid-1"
role="grid"
>
Expand All @@ -25,7 +24,6 @@ snapshots["sbb-autocomplete-grid Safari DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
icon-name="dog-small"
id="sbb-autocomplete-grid-button-1"
role="button"
Expand All @@ -50,7 +48,6 @@ snapshots["sbb-autocomplete-grid Safari DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
icon-name="dog-small"
id="sbb-autocomplete-grid-button-2"
role="button"
Expand Down Expand Up @@ -95,10 +92,7 @@ snapshots["sbb-autocomplete-grid Safari Shadow DOM"] =
/* end snapshot sbb-autocomplete-grid Safari Shadow DOM */

snapshots["sbb-autocomplete-grid Chrome-Firefox DOM"] =
`<sbb-autocomplete-grid
data-state="closed"
dir="ltr"
>
`<sbb-autocomplete-grid data-state="closed">
<sbb-autocomplete-grid-row
id="sbb-autocomplete-grid-row-1"
role="row"
Expand All @@ -116,7 +110,6 @@ snapshots["sbb-autocomplete-grid Chrome-Firefox DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
icon-name="dog-small"
id="sbb-autocomplete-grid-button-1"
role="button"
Expand All @@ -141,7 +134,6 @@ snapshots["sbb-autocomplete-grid Chrome-Firefox DOM"] =
aria-disabled="false"
data-action=""
data-button=""
dir="ltr"
icon-name="dog-small"
id="sbb-autocomplete-grid-button-2"
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { customElement } from 'lit/decorators.js';
import { SbbAutocompleteBaseElement } from '../../autocomplete.js';
import { getNextElementIndex } from '../../core/a11y.js';
import { hostAttributes } from '../../core/decorators.js';
import { getDocumentWritingMode, isSafari } from '../../core/dom.js';
import { isSafari } from '../../core/dom.js';
import { setAriaComboBoxAttributes } from '../../core/overlay.js';
import type { SbbDividerElement } from '../../divider.js';
import type { SbbOptGroupElement, SbbOptionElement } from '../../option.js';
Expand Down Expand Up @@ -33,7 +33,6 @@ const ariaRoleOnHost = isSafari;
*/
@customElement('sbb-autocomplete-grid')
@hostAttributes({
dir: getDocumentWritingMode(),
role: ariaRoleOnHost ? 'grid' : null,
})
export class SbbAutocompleteGridElement extends SbbAutocompleteBaseElement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const snapshots = {};
snapshots["sbb-autocomplete renders standalone Safari DOM"] =
`<sbb-autocomplete
data-state="closed"
dir="ltr"
id="sbb-autocomplete-1"
origin="origin"
role="listbox"
Expand Down Expand Up @@ -86,7 +85,6 @@ snapshots["sbb-autocomplete renders in form field Safari DOM"] =
>
<sbb-autocomplete
data-state="closed"
dir="ltr"
id="sbb-autocomplete-3"
role="listbox"
>
Expand Down Expand Up @@ -154,7 +152,6 @@ snapshots["sbb-autocomplete renders in form field Safari Shadow DOM"] =
snapshots["sbb-autocomplete renders standalone Chrome-Firefox DOM"] =
`<sbb-autocomplete
data-state="closed"
dir="ltr"
origin="origin"
trigger="trigger"
>
Expand Down Expand Up @@ -236,10 +233,7 @@ snapshots["sbb-autocomplete renders in form field Chrome-Firefox DOM"] =
autocomplete="off"
role="combobox"
>
<sbb-autocomplete
data-state="closed"
dir="ltr"
>
<sbb-autocomplete data-state="closed">
<sbb-option
aria-selected="false"
data-slot-names="unnamed"
Expand Down
3 changes: 1 addition & 2 deletions src/elements/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { customElement } from 'lit/decorators.js';

import { getNextElementIndex } from '../core/a11y.js';
import { hostAttributes } from '../core/decorators.js';
import { getDocumentWritingMode, isSafari } from '../core/dom.js';
import { isSafari } from '../core/dom.js';
import { setAriaComboBoxAttributes } from '../core/overlay.js';
import type { SbbOptGroupElement, SbbOptionElement } from '../option.js';

Expand Down Expand Up @@ -30,7 +30,6 @@ const ariaRoleOnHost = isSafari;
*/
@customElement('sbb-autocomplete')
@hostAttributes({
dir: getDocumentWritingMode(),
role: ariaRoleOnHost ? 'listbox' : null,
})
export class SbbAutocompleteElement extends SbbAutocompleteBaseElement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ snapshots["sbb-breadcrumb-group renders DOM"] =
<sbb-breadcrumb
data-action=""
data-link=""
dir="ltr"
href="https://example.com"
icon-name="pie-small"
slot="li-0"
Expand All @@ -18,7 +17,6 @@ snapshots["sbb-breadcrumb-group renders DOM"] =
<sbb-breadcrumb
data-action=""
data-link=""
dir="ltr"
href="https://example.com/one"
slot="li-1"
>
Expand All @@ -28,7 +26,6 @@ snapshots["sbb-breadcrumb-group renders DOM"] =
aria-current="page"
data-action=""
data-link=""
dir="ltr"
href="https://example.com/one"
slot="li-2"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ snapshots["sbb-breadcrumb renders with text DOM"] =
`<sbb-breadcrumb
data-action=""
data-link=""
dir="ltr"
download=""
href="https://example.com/test"
rel="subsection"
Expand Down Expand Up @@ -41,7 +40,6 @@ snapshots["sbb-breadcrumb renders with icon DOM"] =
`<sbb-breadcrumb
data-action=""
data-link=""
dir="ltr"
href="/"
icon-name="house-small"
>
Expand Down Expand Up @@ -79,7 +77,6 @@ snapshots["sbb-breadcrumb renders with icon and text DOM"] =
`<sbb-breadcrumb
data-action=""
data-link=""
dir="ltr"
href="/"
icon-name="house-small"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe(`sbb-breadcrumb`, () => {

beforeEach(async () => {
element = await fixture(html`
<sbb-breadcrumb dir="ltr" data-action data-link href="/" icon-name="house-small">
<sbb-breadcrumb data-action data-link href="/" icon-name="house-small">
Home
</sbb-breadcrumb>
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ snapshots["sbb-button-link renders a sbb-button-link without icon DOM"] =
data-link=""
data-sbb-button=""
data-slot-names="unnamed"
dir="ltr"
download=""
href="https://www.sbb.ch"
rel="noopener"
Expand Down Expand Up @@ -46,7 +45,6 @@ snapshots["sbb-button-link renders a disabled sbb-button-link with slotted icon
data-link=""
data-sbb-button=""
data-slot-names="icon unnamed"
dir="ltr"
disabled=""
href="https://www.sbb.ch"
size="l"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ snapshots["sbb-button-static renders without icon DOM"] =
data-action=""
data-sbb-button=""
data-slot-names="unnamed"
dir="ltr"
disabled=""
negative=""
size="m"
Expand All @@ -33,7 +32,6 @@ snapshots["sbb-button-static renders with slotted icon DOM"] =
data-action=""
data-sbb-button=""
data-slot-names="icon unnamed"
dir="ltr"
size="l"
>
<sbb-icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ snapshots["sbb-button renders a sbb-button without icon DOM"] =
data-button=""
data-sbb-button=""
data-slot-names="unnamed"
dir="ltr"
disabled=""
form="formid"
name="name"
Expand Down Expand Up @@ -42,7 +41,6 @@ snapshots["sbb-button renders a sbb-button with slotted icon DOM"] =
data-button=""
data-sbb-button=""
data-slot-names="icon unnamed"
dir="ltr"
role="button"
size="l"
tabindex="0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ snapshots["sbb-mini-button-group renders DOM"] =
<sbb-mini-button
data-action=""
data-button=""
dir="ltr"
icon-name="pen-small"
role="button"
slot="li-0"
Expand All @@ -26,7 +25,6 @@ snapshots["sbb-mini-button-group renders DOM"] =
<sbb-mini-button
data-action=""
data-button=""
dir="ltr"
icon-name="pen-small"
role="button"
slot="li-2"
Expand Down Expand Up @@ -70,7 +68,6 @@ snapshots["sbb-mini-button-group renders negative DOM"] =
<sbb-mini-button
data-action=""
data-button=""
dir="ltr"
icon-name="pen-small"
negative=""
role="button"
Expand All @@ -81,7 +78,6 @@ snapshots["sbb-mini-button-group renders negative DOM"] =
<sbb-mini-button
data-action=""
data-button=""
dir="ltr"
icon-name="pen-small"
negative=""
role="button"
Expand Down
Loading

0 comments on commit 164e3bc

Please sign in to comment.