Skip to content

fix(material/slide-toggle): Increase slide-toggle transition time #29441

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: main
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
4 changes: 2 additions & 2 deletions src/material/core/tokens/m2/mat/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ $prefix: (mat, switch);
// the m3 slide-toggle uses opacity.
visible-track-opacity: 1,
hidden-track-opacity: 1,
visible-track-transition: transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1),
hidden-track-transition: transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1),
visible-track-transition: transform 300ms 0ms cubic-bezier(0, 0, 0.2, 1),
hidden-track-transition: transform 300ms 0ms cubic-bezier(0.4, 0, 0.6, 1),
track-outline-width: 1px,
track-outline-color: transparent,
selected-track-outline-width: 1px,
Expand Down
4 changes: 2 additions & 2 deletions src/material/core/tokens/m3/mat/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ $prefix: (mat, switch);
// the m3 slide-toggle uses opacity.
visible-track-opacity: token-utils.hardcode(1, $exclude-hardcoded),
hidden-track-opacity: token-utils.hardcode(0, $exclude-hardcoded),
visible-track-transition: token-utils.hardcode(opacity 75ms, $exclude-hardcoded),
hidden-track-transition: token-utils.hardcode(opacity 75ms, $exclude-hardcoded),
visible-track-transition: token-utils.hardcode(opacity 300ms, $exclude-hardcoded),
hidden-track-transition: token-utils.hardcode(opacity 300ms, $exclude-hardcoded),
track-outline-width: token-utils.hardcode(2px, $exclude-hardcoded),
track-outline-color: map.get($systems, md-sys-color, outline),
selected-track-outline-width: token-utils.hardcode(2px, $exclude-hardcoded),
Expand Down
12 changes: 6 additions & 6 deletions src/material/slide-toggle/slide-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ $_mat-slots: (tokens-mat-switch.$prefix, tokens-mat-switch.get-token-slots());
}

&::before {
transition: transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1);
transition: transform 300ms 0ms cubic-bezier(0, 0, 0.2, 1);
transform: translateX(0);

.mdc-switch--selected & {
transition: transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1);
transition: transform 300ms 0ms cubic-bezier(0.4, 0, 0.6, 1);
transform: translateX(100%);

[dir='rtl'] .mdc-switch--selected & {
Expand Down Expand Up @@ -173,7 +173,7 @@ $_mat-slots: (tokens-mat-switch.$prefix, tokens-mat-switch.get-token-slots());
pointer-events: none;
position: absolute;
top: 0;
transition: transform 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1);
transition: transform 300ms 0ms cubic-bezier(0.4, 0, 0.2, 1);
left: 0;
right: auto;
transform: translateX(0);
Expand Down Expand Up @@ -208,9 +208,9 @@ $_mat-slots: (tokens-mat-switch.$prefix, tokens-mat-switch.get-token-slots());
// Used for M3 animations. Does not affect the M2 slide-toggle
// because the width and height are static, and the margin is unused.
transition:
width 75ms cubic-bezier(0.4, 0, 0.2, 1),
height 75ms cubic-bezier(0.4, 0, 0.2, 1),
margin 75ms cubic-bezier(0.4, 0, 0.2, 1);
width 300ms cubic-bezier(0.4, 0, 0.2, 1),
height 300ms cubic-bezier(0.4, 0, 0.2, 1),
margin 300ms cubic-bezier(0.4, 0, 0.2, 1);

[dir='rtl'] & {
left: auto;
Expand Down
Loading