Draft
Conversation
Add an accessible toggle switch component with full ARIA support, controlled/uncontrolled state management, error handling, and comprehensive documentation.
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Add jest-axe tests covering all states: unchecked, checked, disabled, disabled checked, error, and label description per CONTRIBUTING.md requirements.
| height: 24px; | ||
| border: 2px solid var(--switch-track-color); | ||
| border-radius: 999px; | ||
| padding: 4px; |
Collaborator
There was a problem hiding this comment.
This should be var(--space-half) for 4px.
Comment on lines
+5
to
+8
| --switch-track-color-checked-disabled: var( | ||
| --accent-primary-disabled, | ||
| #78a6d8 | ||
| ); |
Collaborator
There was a problem hiding this comment.
#78a6d8 is the same as --accent-primary-disabled which seems unnecessary.
| :root { | ||
| --switch-track-color: var(--gray-90); | ||
| --switch-track-color-checked: var(--accent-primary); | ||
| --switch-track-color-disabled: var(--gray-40); |
Collaborator
There was a problem hiding this comment.
Shouldn't this be var(--disabled) instead?
| #78a6d8 | ||
| ); | ||
| --switch-handle-color: var(--gray-90); | ||
| --switch-handle-color-disabled: var(--gray-40); |
Collaborator
There was a problem hiding this comment.
Shouldn't this be var(--disabled) instead?
| @@ -0,0 +1,2 @@ | |||
| export { default, Switch } from './Switch'; | |||
Collaborator
There was a problem hiding this comment.
These exports are redundant and should probably follow how we do it in other components like export { default as ActionMenu } from './ActionMenu';
Suggested change
| export { default, Switch } from './Switch'; | |
| export { default as Switch } from './Switch'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switchtoggle component with full ARIArole="switch"supportTest plan
yarn testand verify all Switch tests passyarn devand verify the Switch docs page renders at/components/Switch