RocketChat / RocketChat/fuselage

Standardize high-contrast focus indicators for ToggleSwitch and CheckBox

Open Beginner friendly
#1,833 7 comments 0 reactions 0 assignees View on GitHub

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:
  1. Open the Fuselage Storybook to the ToggleSwitch or CheckBox section.
  2. Tab through the components using the keyboard.
  3. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.