Skip to content

ARIA and keyboard accessibility improvements#26

Open
shekharnwagh wants to merge 4 commits intotrunkfrom
a11y/rsm-316-aria-and-keyboard-audit
Open

ARIA and keyboard accessibility improvements#26
shekharnwagh wants to merge 4 commits intotrunkfrom
a11y/rsm-316-aria-and-keyboard-audit

Conversation

@shekharnwagh
Copy link
Copy Markdown
Contributor

@shekharnwagh shekharnwagh commented Apr 29, 2026

Summary

Improves command palette accessibility by tightening ARIA semantics, accessible names, screen-reader result feedback, loading state semantics, focus restoration, and keyboard behavior coverage.

Closes RSM-316

What changed

  • Gives the command input a mode-specific accessible name: Search commands in command mode and Select <param> in parameter-selection mode.
  • Keeps the longer Backspace hint in the placeholder instead of using it as the input's computed accessible name.
  • Adds a polite status region for filtered command and option counts, including empty-result messaging.
  • Suppresses result-count announcements while async route resolution is loading to avoid competing loading announcements.
  • Marks the listbox as busy during async route resolution and keeps the loading progressbar exposed to assistive technology.
  • Restores focus to the previously focused element when the palette closes after being opened with the hotkey.
  • Expands test coverage for dialog, combobox, listbox, group, and option semantics; result-count announcements; loading state; focus restoration; arrow-key looping; Enter selection; Escape close; and parameter-selection labels.

Testing

  • pnpm format:check
  • pnpm lint
  • pnpm test
  • pnpm build
  • Playground: opened the palette and verified the dialog, combobox, and listbox accessible names.
  • Playground: filtered commands and verified the result-count status updates.

Notes

  • Group accessible names are provided by cmdk's generated aria-labelledby wiring rather than literal aria-label attributes.
  • Tab focus trapping was verified manually in the browser because jsdom does not implement real browser tab order. Unit tests cover focus restoration and keyboard behavior around the dialog.
  • VoiceOver-specific behavior for announcing the initially highlighted option is intentionally left for a separate follow-up.

@shekharnwagh shekharnwagh self-assigned this Apr 29, 2026
@shekharnwagh shekharnwagh force-pushed the a11y/rsm-316-aria-and-keyboard-audit branch 2 times, most recently from 9dde627 to 4b389b9 Compare April 30, 2026 14:50
@shekharnwagh shekharnwagh changed the title [WIP Do Not Merge] ARIA and keyboard accessibility improvements ARIA and keyboard accessibility improvements Apr 30, 2026
@shekharnwagh shekharnwagh marked this pull request as ready for review April 30, 2026 17:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves the accessibility of the command palette by refining ARIA semantics/announcements, adding focus restoration on close, and expanding keyboard/ARIA test coverage.

Changes:

  • Adds a live status region that announces filtered result counts and updates input accessible labeling for command vs param-selection modes.
  • Adds focus restoration to the previously focused element when the palette closes.
  • Marks the suggestions listbox as busy during async route resolution and expands related accessibility + keyboard behavior tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/commands.tsx Adds result-count live region, dynamic input labeling/placeholder, listbox aria-busy, and focus restoration logic.
src/commands.test.tsx Adds tests for focus restoration, ARIA roles/names, result-count announcements, looping arrow-key navigation, and loading/busy semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands.tsx
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves the command palette’s accessibility semantics and keyboard/focus behavior by refining ARIA labeling/announcements, exposing loading state to assistive tech, and adding tests to validate these behaviors.

Changes:

  • Added a polite live region that announces filtered result counts (and suppresses announcements during loading/error states).
  • Improved input accessible naming (mode-specific aria-label) and listbox loading semantics (aria-busy).
  • Added tests covering ARIA roles/names, live announcements, loading state exposure, focus restoration, and keyboard looping behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/commands.tsx Adds result-count live region, improved ARIA labeling, listbox busy state, and focus restoration behavior.
src/commands.test.tsx Expands coverage for accessibility semantics, result announcements, loading state, focus restoration, and keyboard navigation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands.tsx
Comment thread src/commands.test.tsx Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves accessibility of the command palette by refining ARIA semantics and labeling, adding screen-reader-friendly result-count feedback, improving loading/error announcement behavior, and ensuring focus is restored after closing.

Changes:

  • Adds a polite status live region that announces filtered command/option result counts (and stays silent during async resolution and resolver errors).
  • Improves accessible naming for the input based on mode (command search vs parameter selection) and keeps Backspace guidance in the placeholder instead of the computed name.
  • Restores focus to the previously focused element when the palette closes, and expands vitest coverage for ARIA semantics + keyboard/focus behaviors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/commands.tsx Adds result-count live region, mode-specific input labeling, listbox busy state, and focus restoration on close.
src/commands.test.tsx Adds/expands tests for dialog/combobox/listbox semantics, live region announcements, loading/error silence, focus restore, and keyboard looping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add result-count announcements for filtered commands and options, mark
the list busy while route resolution is loading, and restore focus to
the previously focused element when the palette closes.
@shekharnwagh shekharnwagh force-pushed the a11y/rsm-316-aria-and-keyboard-audit branch from c375676 to f857a2d Compare May 1, 2026 09:51
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.

2 participants