Skip to content

fix: Add role "switch" to toggle component - #5234

Merged
cansuaa merged 6 commits into
mainfrom
cansua/a11y-toggle
Nov 4, 2026
Merged

cansuaa merged 6 commits into
mainfrom
cansua/a11y-toggle

Conversation

@cansuaa

@cansuaa cansuaa commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Description

Add role "switch" to toggle component. Currently NVDA and JAWS announce toggles as checkboxes, semantically and from announcement perspective it makes more sense for toggle to be announced as switch. Both roles are very similar, it shouldn't create a difference for us except the way the toggle component is announced.

Related links, issue #, if available: AWSUI-62424

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.82%. Comparing base (2b56e54) to head (c203615).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5234   +/-   ##
=======================================
  Coverage   97.82%   97.82%           
=======================================
  Files        1006     1006           
  Lines       32583    32583           
  Branches    12094    12094           
=======================================
  Hits        31875    31875           
  Misses        666      666           
  Partials       42       42           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cansuaa cansuaa changed the title fix: Toggle input type to switch fix: Add role "switch" to toggle component Nov 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The switch-role fix lacks a targeted regression assertion, so the existing tests would not catch removal of the role.

1 open issue
What changed in this PR

Updates the Toggle component’s accessibility semantics so screen readers identify it as a switch rather than a checkbox.

Changes:

  • Adds role="switch" to the native input while retaining type="checkbox" and existing behavior.
File Description
src/​toggle/​internal.tsx Adds the switch role to the Toggle input.

Review effort: Balanced

Comment thread src/toggle/internal.tsx Resolved
@cansuaa
cansuaa added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 3, 2026
@cansuaa
cansuaa added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit d3f49a7 Nov 4, 2026
68 checks passed
@cansuaa
cansuaa deleted the cansua/a11y-toggle branch November 4, 2026 09:56
ernst-dev pushed a commit to TrevorBurnham/cloudscape-components that referenced this pull request Nov 6, 2026
cansuaa added a commit that referenced this pull request Nov 6, 2026
cansuaa added a commit that referenced this pull request Nov 6, 2026

This branch was successfully deployed

3 active deployments
dev-pages-react16 — c2036152 Deployed Nov 3, 2026 by cansuaa via deploy (React 16) / deploy #3139
dev-pages-react18 — c2036152 Deployed Nov 3, 2026 by cansuaa via deploy (React 18) / deploy #3139
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.

3 participants