RocketChat / RocketChat/fuselage
Standardize high-contrast focus indicators for ToggleSwitch and CheckBox
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 162
- Forks
- 258
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 24
Description
Problem Description
The focus indicators for ToggleSwitch and CheckBox currently rely on legacy shadow definitions that do not consistently utilize the design system's @focus-ring-color token.
This leads to:
- Inconsistency: These inputs look different when focused compared to Button or TextInput.
- Accessibility Gap: On certain background colors (especially in Dark Mode), the focus ring contrast ratio is below the WCAG 2.1 AA requirement of 3:1 for user interface components.
Steps to Reproduce:
- Open the Fuselage Storybook to the ToggleSwitch or CheckBox section.
- Tab through the components using the keyboard.
- Observe that the focus ring is either missing or has poor visibility compared to standard Text Inputs.
Proposed Solution:
Refactor the focus state styling in the following files to use the global focus ring token:
- packages/fuselage/src/components/ToggleSwitch/ToggleSwitch.styles.scss
- packages/fuselage/src/components/CheckBox/CheckBox.styles.scss
Instead of legacy box-shadow values, implement the standard focus ring behavior:
&:focus + .rcx-toggle-switch__fake,
&:focus + .rcx-check-box__fake {
@include focus-ring; // Or the equivalent variable/mixin used in the project
}
Impact
- Ensures the library meets modern accessibility standards (A11y).
- Reduces technical debt by migrating from hardcoded values to design tokens.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/fuselage/src/components/ToggleSwitch/ToggleSwitch.styles.scss and packages/fuselage/src/components/CheckBox/CheckBox.styles.scss, then inspect the existing focus-ring token or mixin used by standard inputs. Use the Fuselage Storybook to keyboard-focus both components in light and dark backgrounds. Done means both focus indicators use the standard token and meet the stated visibility and contrast goal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, scss
- Domain
- accessibility, design, frontend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100