[autocomplete] Improve command palette accessibility#4949
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,244.68 ms -143.01 ms(-10.3%) | Renders: 50 (+0) | Paint: 1,858.77 ms -239.06 ms(-11.4%)
11 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The code/test checks are green; the remaining failing check is |
There was a problem hiding this comment.
💡 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} |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
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