Skip to content

Standardize high-contrast focus indicators for ToggleSwitch and CheckBox #1833

@Kalpana-chavhan

Description

@Kalpana-chavhan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions