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

オープン
#1,453 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@atanunath66-stack がすでに取り組んでいます。

2026年11月24日 から。

  • #1462 @atanunath66-stack による — オープン

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, react

調査の方向性

Start in packages/ui-elements at CheckBox.js, where the <input> is hidden with style={{ display: 'none' }}, and read CheckBox.styles.js for the outline: none rule; the story to update lives in CheckBox.stories.js. Reproduce first with cd packages/ui-elements && npx storybook dev -p 6006, tabbing through the default story to confirm the checkbox is skipped. Done means the input stays in the tab order and accessibility tree (visually-hidden CSS rather than display: none), a :focus-visible ring using theme.colors.ring appears, Space toggles it, defaultChecked works uncontrolled, and the jsx-a11y suppression is removed.

索引モデルが issue の本文から書いたものです。

説明

bug
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?

主要言語
JavaScript
スター
171
フォーク
421
平均マージ
3日 6時間
マージ済み PR(30日)
4

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RocketChat/EmbeddedChat のほかの issue

RocketChat/EmbeddedChat の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。