Skip to content

[Bug]: CheckBox is keyboard-inaccessible (display: none), missing focus indicators, and lacks uncontrolled state support #1453

Open

Description

@Siddh2024

Description:

The CheckBox component in @embeddedchat/ui-elements has several accessibility and usability compliance issues:

  1. Inaccessible to Keyboard & Assistive Technologies (WCAG 2.1.1, WCAG 4.1.2):
    The underlying <input type="checkbox"> is hidden using style={{ display: 'none' }} in CheckBox.js. In all modern browsers, display: 'none' completely removes the input from the accessibility tree and eliminates it from the keyboard Tab order. Consequently:

    • Keyboard users cannot tab to the checkbox or toggle it using Space.
    • Screen readers completely skip it.
    • The accessibility linter warning was suppressed with // eslint-disable-next-line jsx-a11y/label-has-associated-control.
  2. Missing :focus-visible Outline (WCAG 2.4.7 Level AA):
    CheckBox.styles.js sets outline: none; without providing an accessible :focus-visible ring when the checkbox receives focus.

  3. Lacks Uncontrolled Mode & Interactive State Handling:
    CheckBox.js does not manage internal state when used as an uncontrolled input (defaultChecked), and strictly binds to checked={checked}. When rendered in Storybook or when used without external controller state, the checkbox is completely frozen and does not toggle on click or change.


Steps to reproduce:

  1. Start Storybook: cd packages/ui-elements && npx storybook dev -p 6006
  2. Open http://localhost:6006/iframe.html?id=components-checkbox--default&viewMode=story
  3. Click on the canvas and press Tab — observe that the checkbox is completely skipped and cannot receive keyboard focus.
  4. Press Space — observe that it cannot be toggled via keyboard.
  5. Inspect the DOM in browser DevTools: observe <input type="checkbox" style="display: none;"> and that the Accessibility pane lists the input as not exposed to the accessibility API.
  6. Click the checkbox in the story — observe that it does not toggle because state is locked without uncontrolled support.

Expected behavior:

  • The native <input type="checkbox"> should use accessible visually-hidden CSS (e.g. position: absolute; opacity: 0; pointer-events: none;) instead of display: 'none', keeping it in the DOM accessibility tree and tab order.
  • The checkbox should display a visible :focus-visible outline matching theme.colors.ring when focused via keyboard.
  • Pressing Space should toggle the checkbox.
  • CheckBox should support both controlled (checked + onChange) and uncontrolled (defaultChecked) patterns.
  • The Storybook story should be interactive.

Proposed Solution:

I would like to resolve this in @embeddedchat/ui-elements:

  • Replace display: 'none' with standard visually-hidden CSS.
  • Add :focus-visible focus ring styles in CheckBox.styles.js.
  • Add support for both controlled (checked) and uncontrolled (defaultChecked / internal state) usage.
  • Remove the disabled jsx-a11y/label-has-associated-control linter suppression.
  • Update CheckBox.stories.js to allow interactive toggling.

May I be assigned this issue?

Activity

  1. added
    bug
    on Nov 22, 2026
  2. Vulpeeharini26 commented on Nov 23, 2026

    @Vulpeeharini26

    Hi! I'd like to work on this. I'll keep the native checkbox in the DOM but
    visually hidden so it's reachable by keyboard and screen readers, add a visible
    :focus-visible style, and make sure click/Space both toggle it. Could I take this?

  3. siddharth9874 commented on Nov 24, 2026

    @siddharth9874

    Hi maintainers!
    I'd like to work on this issue. I understand it involves improving the CheckBox component's keyboard accessibility, focus indicators, controlled/uncontrolled state support, and Storybook interaction.
    I'm interested in contributing a fix and would appreciate it if you could assign this issue to me or confirm that I can work on it.
    Thank you!

  4. atanunath66-stack commented on Nov 24, 2026

    @atanunath66-stack

    Hi maintainers! I noticed that a couple of contributors have expressed interest in this issue. I'm also interested in contributing and can work on the accessibility improvements, controlled/uncontrolled state support, and Storybook updates.
    Could you please confirm whether the issue is still open for another contributor, or whether someone has already started working on it?
    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions