Skip to content

feat: remove dir polyfill [CSS-222] #4014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: spectrum-two
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .changeset/shiny-taxis-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
"@spectrum-css/actionbutton": major
"@spectrum-css/colorslider": major
"@spectrum-css/progressbar": major
"@spectrum-css/breadcrumb": major
"@spectrum-css/colorloupe": major
"@spectrum-css/colorwheel": major
"@spectrum-css/pagination": major
"@spectrum-css/accordion": major
"@spectrum-css/assetlist": major
"@spectrum-css/colorarea": major
"@spectrum-css/calendar": major
"@spectrum-css/combobox": major
"@spectrum-css/steplist": major
"@spectrum-css/treeview": major
"@spectrum-css/popover": major
"@spectrum-css/tooltip": major
"@spectrum-css/slider": major
"@spectrum-css/switch": major
"@spectrum-css/radio": major
"@spectrum-css/table": major
"@spectrum-css/menu": major
"@spectrum-css/tabs": major
---

This update removes the `dir` attribute polyfill (served via a PostCSS transform to compiled assets) as the fallback is no longer necessary. The`dir` attribute support is available in all supported browsers and has been tested to correctly inherit inside web component shadow DOMs. This is a breaking change **only** to those relying on the `dir` attribute being present for styling, however, the `:dir` pseudo will correctly inherit values from their containers. To correctly determine the `dir` value of a node using JavaScript, you can use `getComputedStyle(node).direction`.
3 changes: 1 addition & 2 deletions components/accordion/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
".spectrum-Accordion:dir(rtl)",
".spectrum-Accordion:lang(ja)",
".spectrum-Accordion:lang(ko)",
".spectrum-Accordion:lang(zh)",
"[dir=\"rtl\"] .spectrum-Accordion"
".spectrum-Accordion:lang(zh)"
],
"modifiers": [
"--mod-accordion-animation-duration",
Expand Down
1 change: 0 additions & 1 deletion components/actionbutton/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
".spectrum-ActionButton:has(.spectrum-ActionButton-icon)",
".spectrum-ActionButton:hover",
".spectrum-ActionButton:not(:has(.spectrum-ActionButton-label))",
"[dir=\"rtl\"] .spectrum-ActionButton",
"a.spectrum-ActionButton"
],
"modifiers": [
Expand Down
3 changes: 1 addition & 2 deletions components/assetlist/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
".spectrum-AssetList-itemChildIndicator",
".spectrum-AssetList-itemLabel",
".spectrum-AssetList-itemSelector",
".spectrum-AssetList:dir(rtl)",
"[dir=\"rtl\"] .spectrum-AssetList"
".spectrum-AssetList:dir(rtl)"
],
"modifiers": [
"--mod-assetlist-border-color-key-focus",
Expand Down
3 changes: 1 addition & 2 deletions components/breadcrumb/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
".spectrum-Breadcrumbs-itemLink[tabindex=\"0\"]:focus-visible",
".spectrum-Breadcrumbs-itemLink[tabindex=\"0\"]:hover",
".spectrum-Breadcrumbs-itemSeparator",
".spectrum-Breadcrumbs-itemSeparator:dir(rtl)",
"[dir=\"rtl\"] .spectrum-Breadcrumbs-itemSeparator"
".spectrum-Breadcrumbs-itemSeparator:dir(rtl)"
],
"modifiers": [
"--mod-breadcrumbs-action-button-color",
Expand Down
3 changes: 1 addition & 2 deletions components/calendar/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
".spectrum-Calendar-tableCell",
".spectrum-Calendar-tableCell:focus",
".spectrum-Calendar-title",
".spectrum-Calendar:dir(rtl)",
"[dir=\"rtl\"] .spectrum-Calendar"
".spectrum-Calendar:dir(rtl)"
],
"modifiers": [
"--mod-calendar-border-radius-reset",
Expand Down
3 changes: 1 addition & 2 deletions components/colorarea/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
".spectrum-ColorArea.is-disabled",
".spectrum-ColorArea.is-disabled .spectrum-ColorArea-gradient",
".spectrum-ColorArea.is-focused",
".spectrum-ColorHandle-color",
"[dir=\"rtl\"] .spectrum-ColorArea-handle"
".spectrum-ColorHandle-color"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in SWC, we would likely to have a breaking change here on the css?

.handle:dir(rtl),
:host([dir="rtl"]) .handle {
    inset-inline-end: 0;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a breaking change on the spectrum-two branch which is released under the next tag. We do a lot of breaking changes on this feature branch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your example, the code may change but the resulting styles would not:

.handle:dir(rtl) {
    inset-inline-end: 0;
}

This is sufficient to apply the styles ^

],
"modifiers": [
"--mod-colorarea-border-color",
Expand Down
3 changes: 1 addition & 2 deletions components/colorloupe/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
".spectrum-ColorLoupe-outer-border",
".spectrum-ColorLoupe.is-disabled",
".spectrum-ColorLoupe.is-open",
".spectrum-ColorLoupe:dir(rtl)",
"[dir=\"rtl\"] .spectrum-ColorLoupe"
".spectrum-ColorLoupe:dir(rtl)"
],
"modifiers": [
"--mod-colorloupe-animation-distance",
Expand Down
3 changes: 1 addition & 2 deletions components/colorslider/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
".spectrum-ColorSlider.is-disabled",
".spectrum-ColorSlider.is-disabled .spectrum-ColorSlider-checkerboard",
".spectrum-ColorSlider.is-disabled .spectrum-ColorSlider-gradient",
".spectrum-ColorSlider.is-focused",
"[dir=\"rtl\"] .spectrum-ColorSlider-gradient"
".spectrum-ColorSlider.is-focused"
],
"modifiers": [
"--mod-color-slider-background-color-disabled",
Expand Down
3 changes: 1 addition & 2 deletions components/colorwheel/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
".spectrum-ColorWheel.is-dragged",
".spectrum-ColorWheel.is-focused",
".spectrum-ColorWheel:after",
".spectrum-ColorWheel:before",
"[dir=\"rtl\"] .spectrum-ColorWheel-ColorArea-handle"
".spectrum-ColorWheel:before"
],
"modifiers": [
"--mod-colorwheel-block-size",
Expand Down
3 changes: 1 addition & 2 deletions components/combobox/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
".spectrum-Combobox:hover:has(:focus) .spectrum-Combobox-button:not(:disabled, .is-invalid, .spectrum-PickerButton--quiet)",
".spectrum-Textfield.is-disabled .spectrum-Textfield-validationIcon",
".spectrum-Textfield.is-loading .spectrum-Textfield-validationIcon",
".spectrum-Textfield.is-readOnly .spectrum-Textfield-validationIcon",
"[dir=\"rtl\"] .spectrum-Combobox-progress-circle"
".spectrum-Textfield.is-readOnly .spectrum-Textfield-validationIcon"
],
"modifiers": [
"--mod-combobox-alert-icon-color",
Expand Down
3 changes: 1 addition & 2 deletions components/menu/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@
".spectrum-Menu.spectrum-Menu--sizeXL",
".spectrum-Menu:lang(ja)",
".spectrum-Menu:lang(ko)",
".spectrum-Menu:lang(zh)",
"[dir=\"rtl\"] .spectrum-Menu .spectrum-Menu-chevron"
".spectrum-Menu:lang(zh)"
],
"modifiers": [
"--mod-menu-back-heading-color",
Expand Down
3 changes: 1 addition & 2 deletions components/pagination/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
".spectrum-Pagination-prevButton",
".spectrum-Pagination-prevButton .spectrum-Icon",
".spectrum-Pagination-textfield",
".spectrum-Pagination:dir(rtl)",
"[dir=\"rtl\"] .spectrum-Pagination"
".spectrum-Pagination:dir(rtl)"
],
"modifiers": [
"--mod-pagination-counter-color",
Expand Down
14 changes: 1 addition & 13 deletions components/popover/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,7 @@
".spectrum-Popover--withTip.spectrum-Popover--top-start .spectrum-Popover-tip",
".spectrum-Popover.is-open",
".spectrum-Popover.spectrum-Popover--withTip",
".spectrum-Popover.spectrum-Popover--withTip .spectrum-Popover-tip .spectrum-Popover-tip-triangle",
"[dir=\"rtl\"] .spectrum-Popover--end-bottom.is-open",
"[dir=\"rtl\"] .spectrum-Popover--end-top.is-open",
"[dir=\"rtl\"] .spectrum-Popover--end.is-open",
"[dir=\"rtl\"] .spectrum-Popover--start-bottom.is-open",
"[dir=\"rtl\"] .spectrum-Popover--start-top.is-open",
"[dir=\"rtl\"] .spectrum-Popover--start.is-open",
"[dir=\"rtl\"] .spectrum-Popover--withTip.spectrum-Popover--end .spectrum-Popover-tip",
"[dir=\"rtl\"] .spectrum-Popover--withTip.spectrum-Popover--end-bottom .spectrum-Popover-tip",
"[dir=\"rtl\"] .spectrum-Popover--withTip.spectrum-Popover--end-top .spectrum-Popover-tip",
"[dir=\"rtl\"] .spectrum-Popover--withTip.spectrum-Popover--start .spectrum-Popover-tip",
"[dir=\"rtl\"] .spectrum-Popover--withTip.spectrum-Popover--start-bottom .spectrum-Popover-tip",
"[dir=\"rtl\"] .spectrum-Popover--withTip.spectrum-Popover--start-top .spectrum-Popover-tip"
".spectrum-Popover.spectrum-Popover--withTip .spectrum-Popover-tip .spectrum-Popover-tip-triangle"
],
"modifiers": [
"--mod-overlay-animation-duration",
Expand Down
3 changes: 1 addition & 2 deletions components/progressbar/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
".spectrum-ProgressBar--staticWhite .spectrum-ProgressBar-label",
".spectrum-ProgressBar--staticWhite .spectrum-ProgressBar-percentage",
".spectrum-ProgressBar--staticWhite .spectrum-ProgressBar-track",
".spectrum-ProgressBar-track",
"[dir=\"rtl\"] .spectrum-ProgressBar--indeterminate .spectrum-ProgressBar-fill"
".spectrum-ProgressBar-track"
],
"modifiers": [
"--mod-progressbar-animation-duration-indeterminate",
Expand Down
3 changes: 1 addition & 2 deletions components/radio/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
".spectrum-Radio:lang(ja)",
".spectrum-Radio:lang(ko)",
".spectrum-Radio:lang(zh)",
".spectrum-Radio:not(.is-readOnly):active .spectrum-Radio-input:not(:disabled) + .spectrum-Radio-button",
"[dir=\"rtl\"] .spectrum-Radio .spectrum-Radio-button:after"
".spectrum-Radio:not(.is-readOnly):active .spectrum-Radio-input:not(:disabled) + .spectrum-Radio-button"
],
"modifiers": [
"--mod-radio-animation-duration",
Expand Down
4 changes: 1 addition & 3 deletions components/slider/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@
".spectrum-Slider:not(.is-disabled, .spectrum-Slider--filled, .spectrum-Slider--range) .spectrum-Slider-controls:active",
".spectrum-Slider:not(.is-disabled, .spectrum-Slider--filled, .spectrum-Slider--range) .spectrum-Slider-controls:focus-within",
".spectrum-Slider:not(.is-disabled, .spectrum-Slider--filled, .spectrum-Slider--range) .spectrum-Slider-controls:hover",
".spectrum-Slider:not(.spectrum-Slider--sideLabel) .spectrum-Slider-labelContainer + .spectrum-Slider-controls:has(.spectrum-Slider-ramp)",
"[dir=\"rtl\"] .spectrum-Slider",
"[dir=\"rtl\"] .spectrum-Slider .spectrum-Slider-handle:before"
".spectrum-Slider:not(.spectrum-Slider--sideLabel) .spectrum-Slider-labelContainer + .spectrum-Slider-controls:has(.spectrum-Slider-ramp)"
],
"modifiers": [
"--mod-animation-duration-100",
Expand Down
5 changes: 1 addition & 4 deletions components/steplist/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
".spectrum-Steplist-label:dir(rtl)",
".spectrum-Steplist-marker",
".spectrum-Steplist-markerContainer",
".spectrum-Steplist-segment",
"[dir=\"rtl\"] .spectrum-Steplist-item:last-child .spectrum-Steplist-label",
"[dir=\"rtl\"] .spectrum-Steplist-item:only-child .spectrum-Steplist-label",
"[dir=\"rtl\"] .spectrum-Steplist-label"
".spectrum-Steplist-segment"
],
"modifiers": [
"--mod-steplist-complete-label-text-color",
Expand Down
5 changes: 1 addition & 4 deletions components/switch/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
".spectrum-Switch:hover .spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch:before",
".spectrum-Switch:hover .spectrum-Switch-switch",
".spectrum-Switch:hover .spectrum-Switch-switch:before",
".spectrum-Switch:hover ~ .spectrum-Switch-label",
"[dir=\"rtl\"] .spectrum-Switch--active .spectrum-Switch-input:not(:disabled):checked + .spectrum-Switch-switch:before",
"[dir=\"rtl\"] .spectrum-Switch-input:checked + .spectrum-Switch-switch:before",
"[dir=\"rtl\"] .spectrum-Switch:active .spectrum-Switch-input:not(:disabled):checked + .spectrum-Switch-switch:before"
".spectrum-Switch:hover ~ .spectrum-Switch-label"
],
"modifiers": [
"--mod-switch-animation-duration-switch",
Expand Down
3 changes: 1 addition & 2 deletions components/table/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@
".spectrum-Table:lang(ja)",
".spectrum-Table:lang(ko)",
".spectrum-Table:lang(zh)",
".spectrum-Table:not(.spectrum-Table-scroller)",
"[dir=\"rtl\"] .spectrum-Table"
".spectrum-Table:not(.spectrum-Table-scroller)"
],
"modifiers": [
"--mod-table-avatar-size",
Expand Down
4 changes: 1 addition & 3 deletions components/tabs/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
".spectrum-Tabs.spectrum-Tabs--sizeL",
".spectrum-Tabs.spectrum-Tabs--sizeS",
".spectrum-Tabs.spectrum-Tabs--sizeXL",
".spectrum-Tabs.spectrum-Tabs--vertical.spectrum-Tabs--compact .spectrum-Tabs-item:before",
"[dir=\"rtl\"] .spectrum-Tabs--vertical",
"[dir=\"rtl\"] .spectrum-Tabs--vertical-right"
".spectrum-Tabs.spectrum-Tabs--vertical.spectrum-Tabs--compact .spectrum-Tabs-item:before"
],
"modifiers": [
"--mod-tabs-animation-duration",
Expand Down
54 changes: 1 addition & 53 deletions components/tooltip/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,59 +247,7 @@
".u-tooltip-showOnHover:hover .spectrum-Tooltip--top-end",
".u-tooltip-showOnHover:hover .spectrum-Tooltip--top-left",
".u-tooltip-showOnHover:hover .spectrum-Tooltip--top-right",
".u-tooltip-showOnHover:hover .spectrum-Tooltip--top-start",
"[dir=\"rtl\"] .spectrum-Tooltip--bottom-end .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--bottom-start .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--end .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--end-bottom .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--end-bottom.is-open",
"[dir=\"rtl\"] .spectrum-Tooltip--end-top .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--end-top.is-open",
"[dir=\"rtl\"] .spectrum-Tooltip--end.is-open",
"[dir=\"rtl\"] .spectrum-Tooltip--left .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--left-bottom .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--left-top .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--right .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--right-bottom .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--right-top .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--start .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--start-bottom .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--start-bottom.is-open",
"[dir=\"rtl\"] .spectrum-Tooltip--start-top .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--start-top.is-open",
"[dir=\"rtl\"] .spectrum-Tooltip--start.is-open",
"[dir=\"rtl\"] .spectrum-Tooltip--top-end .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .spectrum-Tooltip--top-start .spectrum-Tooltip-tip",
"[dir=\"rtl\"] .u-tooltip-showOnHover .spectrum-Tooltip--end",
"[dir=\"rtl\"] .u-tooltip-showOnHover .spectrum-Tooltip--end-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover .spectrum-Tooltip--end-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover .spectrum-Tooltip--start",
"[dir=\"rtl\"] .u-tooltip-showOnHover .spectrum-Tooltip--start-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover .spectrum-Tooltip--start-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover :focus .spectrum-Tooltip--end",
"[dir=\"rtl\"] .u-tooltip-showOnHover :focus .spectrum-Tooltip--end-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover :focus .spectrum-Tooltip--end-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover :focus .spectrum-Tooltip--start",
"[dir=\"rtl\"] .u-tooltip-showOnHover :focus .spectrum-Tooltip--start-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover :focus .spectrum-Tooltip--start-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover.is-focused .spectrum-Tooltip--end",
"[dir=\"rtl\"] .u-tooltip-showOnHover.is-focused .spectrum-Tooltip--end-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover.is-focused .spectrum-Tooltip--end-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover.is-focused .spectrum-Tooltip--start",
"[dir=\"rtl\"] .u-tooltip-showOnHover.is-focused .spectrum-Tooltip--start-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover.is-focused .spectrum-Tooltip--start-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover:focus .spectrum-Tooltip--end",
"[dir=\"rtl\"] .u-tooltip-showOnHover:focus .spectrum-Tooltip--end-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover:focus .spectrum-Tooltip--end-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover:focus .spectrum-Tooltip--start",
"[dir=\"rtl\"] .u-tooltip-showOnHover:focus .spectrum-Tooltip--start-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover:focus .spectrum-Tooltip--start-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover:hover .spectrum-Tooltip--end",
"[dir=\"rtl\"] .u-tooltip-showOnHover:hover .spectrum-Tooltip--end-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover:hover .spectrum-Tooltip--end-top",
"[dir=\"rtl\"] .u-tooltip-showOnHover:hover .spectrum-Tooltip--start",
"[dir=\"rtl\"] .u-tooltip-showOnHover:hover .spectrum-Tooltip--start-bottom",
"[dir=\"rtl\"] .u-tooltip-showOnHover:hover .spectrum-Tooltip--start-top"
".u-tooltip-showOnHover:hover .spectrum-Tooltip--top-start"
],
"modifiers": [
"--mod-overlay-animation-duration",
Expand Down
3 changes: 1 addition & 2 deletions components/treeview/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
".spectrum-TreeView.spectrum-TreeView--detached",
".spectrum-TreeView.spectrum-TreeView--quiet",
".spectrum-TreeView.spectrum-TreeView--thumbnail",
".spectrum-TreeView:dir(rtl)",
"[dir=\"rtl\"] .spectrum-TreeView"
".spectrum-TreeView:dir(rtl)"
],
"modifiers": [
"--mod-treeview-font-size",
Expand Down
1 change: 0 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ module.exports = ({
stage: 2,
env,
features: {
"dir-pseudo-class": { preserve: true },
"nesting-rules": {
preserve: true,
edition: "2021",
Expand Down
Loading