Skip to content

[autocomplete] Improve command palette accessibility#4949

Open
SSDWGG wants to merge 1 commit into
mui:masterfrom
SSDWGG:codex/command-palette-a11y-shortcuts
Open

[autocomplete] Improve command palette accessibility#4949
SSDWGG wants to merge 1 commit into
mui:masterfrom
SSDWGG:codex/command-palette-a11y-shortcuts

Conversation

@SSDWGG
Copy link
Copy Markdown

@SSDWGG SSDWGG commented May 30, 2026

Summary

  • focus the command palette autocomplete input when the dialog opens
  • give the input an explicit accessible name and describe the available keyboard commands
  • make the visible Actions shortcut platform-neutral by showing Ctrl/Cmd + K

Why

The command palette demo currently opens with the inline autocomplete list already active, and the footer shortcuts are only visible text. Screen reader users can miss the search input and the available command shortcuts. This updates both CSS Modules and Tailwind variants so the demo announces the input and exposes the instructions through aria-describedby.

Closes #4247
Closes #4248

Tests

  • pnpm prettier
  • pnpm typescript
  • pnpm exec eslint docs/src/app/(docs)/react/components/autocomplete/demos/command-palette/css-modules/index.tsx docs/src/app/(docs)/react/components/autocomplete/demos/command-palette/tailwind/index.tsx --max-warnings 0
  • pnpm stylelint docs/src/app/(docs)/react/components/autocomplete/demos/command-palette/css-modules/index.module.css

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 30, 2026

commit: ae7b7f3

@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 30, 2026

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 1,244.68 ms -143.01 ms(-10.3%) | Renders: 50 (+0) | Paint: 1,858.77 ms -239.06 ms(-11.4%)

Test Duration Renders
Checkbox mount (500 instances) 72.09 ms ▼-19.59 ms(-21.4%) 1 (+0)

11 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 30, 2026

Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ae7b7f3
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a1a5e17e394190008270168
😎 Deploy Preview https://deploy-preview-4949--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@SSDWGG
Copy link
Copy Markdown
Author

SSDWGG commented May 30, 2026

The code/test checks are green; the remaining failing check is test-label-applied, which requires at least one PR label. I do not have permission to add labels from this fork; could a maintainer please add accessibility when reviewing?

@SSDWGG SSDWGG marked this pull request as ready for review May 30, 2026 09:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae7b7f3fd1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<Dialog.Popup
className={styles.Popup}
aria-label="Command palette"
initialFocus={inputRef}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve touch focus behavior when opening

When the palette is opened from a touch trigger, this unconditional initialFocus={inputRef} bypasses Dialog.Popup's default touch behavior in DialogPopup.tsx, which focuses the popup instead of an input to avoid opening the virtual keyboard. On phones/tablets, tapping “Open command palette” in this demo (and the Tailwind variant with the same prop) will now immediately focus the search field and show the keyboard; consider using an initialFocus function that only returns the input for non-touch opens and preserves the popup/default behavior for touch.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

1 participant