-
Notifications
You must be signed in to change notification settings - Fork 103
feat(switch): update focus styles and outline knob outline #2797
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,12 +42,14 @@ | |
| } | ||
|
|
||
| .Switch-input:focus ~ .Switch-wrapper { | ||
| box-shadow: var(--shadow-spread) var(--secondary-shadow); | ||
| box-shadow: 0 0 0 var(--spacing-05) var(--shadow-0), | ||
| 0 0 0 calc(var(--spacing-05) + var(--border-width-05)) var(--primary-focus); | ||
| background-color: var(--secondary-light); | ||
| } | ||
|
|
||
| .Switch-input:focus ~ .Switch-wrapper--checked { | ||
| box-shadow: var(--shadow-spread) var(--primary-shadow); | ||
| box-shadow: 0 0 0 var(--spacing-05) var(--shadow-0), | ||
| 0 0 0 calc(var(--spacing-05) + var(--border-width-05)) var(--primary-focus); | ||
| background-color: var(--primary); | ||
| } | ||
|
|
||
|
|
@@ -63,6 +65,10 @@ | |
| background-color: var(--secondary-dark); | ||
| } | ||
|
|
||
| .Switch-input:active ~ .Switch-wrapper:before { | ||
| outline-color: var(--inverse-light); | ||
| } | ||
|
|
||
| .Switch-input:active ~ .Switch-wrapper--checked { | ||
| background-color: var(--primary-darker); | ||
| } | ||
|
|
@@ -88,6 +94,8 @@ | |
| border-radius: var(--border-radius-full); | ||
| box-sizing: border-box; | ||
| transition-duration: 80ms; | ||
| outline: 1px solid var(--inverse-lighter); | ||
| outline-offset: -1px; | ||
|
Comment on lines
+97
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This introduces fixed pixel values ( Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| .Switch-wrapper--checked { | ||
|
|
@@ -102,6 +110,7 @@ | |
| -ms-transform: translateX(100%); | ||
| transform: translateX(100%); | ||
| transition-duration: 80ms; | ||
| outline: none; | ||
| } | ||
|
|
||
| .Switch--disabled { | ||
|
|
@@ -112,6 +121,10 @@ | |
| background-color: var(--secondary-lighter); | ||
| } | ||
|
|
||
| .Switch-wrapper--disabled:before { | ||
| outline-color: var(--secondary-dark); | ||
| } | ||
|
|
||
| .Switch-wrapper--checkedDisabled { | ||
| background-color: var(--primary-lighter); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new focus rule hard-codes a full
box-shadowrecipe inswitch.module.css, which violates the repository’s mandatory design-token rule inAGENTS.md(no hard-coded box-shadow rules outside token files) and bypasses the centralized shadow mappings incss/src/variables/index.css; this makes future theme/token updates inconsistent because Switch focus styling will no longer track token-level shadow changes.Useful? React with 👍 / 👎.