Skip to content

feat(switch): add aria-checked attribute - #1761

Open
khalilurrrahmanridoykhan wants to merge 1 commit into
dhis2:masterfrom
khalilurrrahmanridoykhan:LIBS-572/switch-aria-checked
Open

feat(switch): add aria-checked attribute#1761
khalilurrrahmanridoykhan wants to merge 1 commit into
dhis2:masterfrom
khalilurrrahmanridoykhan:LIBS-572/switch-aria-checked

Conversation

@khalilurrrahmanridoykhan

@khalilurrrahmanridoykhan khalilurrrahmanridoykhan commented Aug 10, 2026

Copy link
Copy Markdown

Implements LIBS-572, part of the library-wide accessibility effort tracked in #1447.


Description

Switch renders role="switch" on its input but never sets aria-checked, which the WAI-ARIA switch pattern requires to communicate toggle state to assistive technology. This mirrors the aria-valuenow fix already shipped for Loader's role="progressbar" in the same effort (#1449).

No prop changes — aria-checked is derived from the existing checked prop, the same pattern Loader used for aria-valuenow/amount.

Was this change primarily generated using an AI tool? Yes — Claude Code, Claude Sonnet 5. 🤖 Used to identify the gap (cross-referencing the WAI-ARIA switch pattern and the merged Loader accessibility PR for precedent), and to draft/verify the fix and test below; I reviewed and understand the change.


Known issues

  • None

Checklist

  • API docs are generated (no prop change, aria-checked is derived from existing checked)
  • Tests were added
  • Storybook demos were added (no new prop/variant to demo — internal a11y attribute only)

Screenshots

No visual change — aria-checked is a non-visual accessibility attribute.

The input renders role="switch" but never set aria-checked, which the
WAI-ARIA switch pattern requires to reflect toggle state to assistive
technology. Mirrors the aria-valuenow fix already shipped for the
Loader's role="progressbar" in the same accessibility effort (dhis2#1447).
@khalilurrrahmanridoykhan
khalilurrrahmanridoykhan requested a review from a team as a code owner August 10, 2026 07:55
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant