Skip to content
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

fix(web-components): update switch to use margin for checked state to support RTL #29505

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

🕵 fluentui-web-components-v3 Open the Visual Regressions report to inspect the affected screenshots

Switch 2 screenshots
Image Name Diff(in Pixels) Image Type
Switch.Checked - RTL.hover.chromium.png 104 Changed
Switch.Checked - RTL.normal.chromium.png 97 Changed

Copy link
Member Author

Choose a reason for hiding this comment

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

image

Copy link
Member

Choose a reason for hiding this comment

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

Switch.Checked - RTL.normal.chromium.png
image

Switch.Checked - RTL.hover.chromium.png
image

"type": "prerelease",
"comment": "fix: update switch to use margin instead of transform for the checked state to support RTL",
"packageName": "@fluentui/web-components",
"email": "chhol@microsoft.com",
"dependentChangeType": "patch"
}
5 changes: 3 additions & 2 deletions packages/web-components/src/switch/switch.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,15 @@ export const styles = css`
height: 14px;
width: 14px;
border-radius: 50%;
margin-inline-start: 0;
background-color: ${colorNeutralForeground3};
transition-duration: ${durationNormal};
transition-timing-function: ${curveEasyEase};
transition-property: transform;
transition-property: margin-inline-start;
}
:host([aria-checked='true']) .checked-indicator {
background-color: ${colorNeutralForegroundInverted};
transform: translateX(20px);
margin-inline-start: calc(100% - 14px);
}
:host([aria-checked='true']:hover) .checked-indicator {
background: ${colorNeutralForegroundInvertedHover};
Expand Down
Loading