Skip to content

feat(a11y): make segmented control component fully a11y compliant [AC-4742] - #1439

Merged
Stefan3002 merged 1 commit into
canonical:mainfrom
Stefan3002:fix-segmented-control-a11y
Oct 16, 2026
Merged

Stefan3002 merged 1 commit into
canonical:mainfrom
Stefan3002:fix-segmented-control-a11y

Conversation

@Stefan3002

@Stefan3002 Stefan3002 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Done

  • All details are here.
  • Made the SegmentedControl component a11y compliant.
  • Guide is here.
  • Also added an aria-label prop to the component to be able to specify what it contains.

QA

Pinging @canonical/react-library-maintainers for a review.

QA steps

  • Run yarn docs
  • Navigate to the SegmentedControl component
  • Confirm these:
    -- You can navigate the tabs via arrow keys
    -- Pressing home key takes you to the first tab
    -- Pressing end key takes you the last one
    -- Pressing tab key shifts focus inside the tab/button selected
    -- Pressing arrow key do not work now anymore. This is because the content itself might want to use them.
    -- Pressing shift + tab keys takes you back to the tabs / buttons

Percy steps

  • TBA

Fixes

Fixes: #1438 and #AC-4742 .

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Resolve the unnamed tablist, documented aria-label API mismatch, and incorrect Up/Down key handling.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Updates SegmentedControl toward ARIA tabs accessibility with keyboard navigation, focus management, labeling, tests, stories, and snapshots.

Changes:

  • Adds tab/panel ARIA relationships and roving focus.
  • Adds arrow, Home, and End keyboard behavior.
  • Expands tests, stories, and snapshots.
  • Requires fixes for labeling API consistency and horizontal key handling.
File Summary
src/​components/​SegmentedControl/​SegmentedControl.tsx Implements accessibility semantics and keyboard interaction; contains unresolved labeling and navigation issues.
src/​components/​SegmentedControl/​SegmentedControl.test.tsx Adds focus and keyboard behavior tests.
src/​components/​SegmentedControl/​SegmentedControl.stories.tsx Updates stories with control labels.
src/​components/​SegmentedControl/​__snapshots__/​SegmentedControl.test.tsx.snap Updates rendered accessibility markup snapshots.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Stefan3002
Stefan3002 force-pushed the fix-segmented-control-a11y branch 2 times, most recently from f62b23a to 9db4a49 Compare October 7, 2026 14:33
@Stefan3002
Stefan3002 requested a lite review from Copilot October 7, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Critical test and snapshot failures, plus an unresolved public accessibility API mismatch.

Review effort: Lite
Findings: 3 High severity

Open (3)
Resolved since last review (2)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

One or more issues must be addressed before approval.

Review effort: Lite
Findings: None

Resolved since last review (3)

@ahmedazizabbassi

Copy link
Copy Markdown

LGTM! I tried it locally and it is working fine. I could not upload my screen record and I do not know why.

@bartaz-canonical bartaz-canonical left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, thanks

@Stefan3002
Stefan3002 merged commit 235c9e5 into canonical:main Oct 16, 2026
8 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tabs component is not a11y compliant

4 participants