feat(search-query-builder): Add auto focus and tab select#115176
feat(search-query-builder): Add auto focus and tab select#115176nsdeschenes wants to merge 6 commits into
Conversation
Allow search query builder comboboxes to expose a focused option override for virtual-focus listboxes. This lets typed suggestions render and commit a focused option without moving DOM focus out of the input. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Focus the first visible suggestion while typing in search term, filter key, and filter value comboboxes. Accept the focused suggestion with Tab so filter key selection moves directly into value entry. Co-Authored-By: OpenAI Codex <noreply@openai.com>
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.46% |
When every visible combobox option is disabled, consume the pending first-option focus request before returning. This keeps the layout effect from retrying on unrelated renders after there is no option to focus. Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Allow search query builder comboboxes to show a suggested option without treating it as the active Enter target. This keeps the default behavior unchanged while giving callers a way to reserve Enter for typed values. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Use the tab-only combobox focus mode for free-text search terms so Enter commits the typed value while Tab accepts the suggested filter key. Co-Authored-By: OpenAI Codex <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 48403a5. Configure here.
| state.commit(); | ||
| } else if (state.selectionManager.focusedKey !== null) { | ||
| state.commit(); | ||
| } |
There was a problem hiding this comment.
Enter key may not commit the visually focused override option
Medium Severity
In focus mode, when Enter is pressed with a focusedKeyOverride, the code calls state.selectionManager.setFocusedKey(focusedKeyOverride) then immediately state.commit(). Since setFocusedKey is a React useState setter (batched), commit() reads the stale focusedKey (still null) and doesn't select the override option. Then combobox.tsx's Enter handler sees focusedKey is still null, falls through the guard, and calls onCustomValueCommitted(inputValue) instead. This creates a mismatch: aria-activedescendant shows the override option as focused, but Enter commits the raw typed text. This affects filterKeyCombobox and valueCombobox which both use the default focus behavior.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 48403a5. Configure here.


Quick POC
TODO