Repository navigation
Conversation
…alog Inside a Radix dialog the field lost keyboard focus and closed the dialog: - Escape closed the dialog along with the option list. It now closes only the list. - Tab out of the open list moved focus to the dialog instead of the next control, because the list unmounted during the focus move. - Removing an option from its button with Enter or Space dropped focus. Focus now returns to the input with the list closed, and Enter no longer reaches cmdk, which selected the highlighted option. - The remove buttons had no accessible names. - A value passed on the first render was not selected until an effect ran.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8abb96fc66
ℹ️ 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".
| setTimeout(() => { | ||
| if (document.activeElement !== inputRef.current) { | ||
| setOpen(false); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Add regression coverage for tabbing out of the open list
When this combobox is open inside a Radix dialog and the user tabs to the following control, this deferred close is the behavior that prevents the dialog focus trap from taking focus. None of the added tests presses Tab or verifies that the following control receives focus, so reverting or breaking this timeout would leave the suite green; add a dialog test that opens the list, tabs forward, and asserts the resulting focus target.
AGENTS.md reference: site/AGENTS.md:L74-L74
Useful? React with 👍 / 👎.
| const focusInputWithListClosed = () => { | ||
| setOpen(false); | ||
| keepListClosedOnFocusRef.current = true; | ||
| inputRef.current?.focus(); | ||
| keepListClosedOnFocusRef.current = false; | ||
| }; |
There was a problem hiding this comment.
Extract the new focus lifecycle from the oversized component
This change adds a ref-mediated focus lifecycle, keyboard handling, a global Escape listener, delayed blur behavior, and button focus restoration directly to a component that grows from roughly 690 to 764 lines. Keeping that coherent interaction lifecycle in a hook or child boundary would prevent this shared component from becoming harder to reason about and test as one monolith.
AGENTS.md reference: site/AGENTS.md:L46-L46
Useful? React with 👍 / 👎.
| // Only from the input: cmdk would otherwise select the highlighted | ||
| // option on a following Enter pressed on a remove button. |
There was a problem hiding this comment.
Correct the ArrowDown rationale
When a remove button owns focus, its Enter handler calls both preventDefault() and stopPropagation(), so the following Enter cannot reach cmdk as this comment claims. The guard may still be appropriate to avoid opening the list from a non-input control, but documenting a contradicted event path makes future focus changes unsafe; rewrite the comment to state the actual invariant.
AGENTS.md reference: AGENTS.md:L90-L91
Useful? React with 👍 / 👎.
…t-templates/multi-select-combobox
…t-templates/multi-select-combobox
…t-templates/multi-select-combobox
Adds the API for attaching workspace templates to a chat project, on the schema and queries in #32309. A project can attach templates, turn on a limit that restricts its chats to them, and set a default template with either a default preset or default parameter values. Attaching a template never grants access to it: every reader is checked against the template's own sharing. This PR stores and returns `limit_templates`; #32310 enforces it. - The limit is opt-in. `limit_templates` is off unless a request turns it on, which is what every existing project gets. - Templates are attached and detached one at a time with `PUT` and `DELETE /chats/projects/{project}/templates/{template}`, so a caller never replaces a list they can only partly see. Attaching needs project `update` and template `use`. Detaching needs project `update` and template `read`, and a template the caller cannot read is reported as not found. `POST /chats/projects` accepts `template_ids`, `limit_templates`, and `default_template` for the new project. - `PATCH /chats/projects/{project}` sets `limit_templates` and `default_template`, and no longer changes which templates are attached. The default must be an attached template the caller can read, and its preset must belong to the template's active version. Default parameter names and values are checked against that version for templates on the classic parameter flow; dynamic parameters are checked when a workspace is built. Detaching the default template clears the default. - Project responses list only the attached templates the caller can read, as `templates`, and count the rest as `hidden_template_count`. `default_template` is omitted when the caller cannot read it. Deleted, deprecated, and agent-disabled templates are left out and are not counted as hidden. - Editing uses `chat_project:update`, which the project owner and the project `admin` ACL role have. - Attaching and detaching are audited as writes to the project, with the template list before and after, including the templates attached while creating a project. Changes to `limit_templates` and the default template are part of the project's own audit diff. Not included: showing which project members lack access to an attached template, and MCP server attachments. Stack (merge top to bottom): - #32309 - #30754 👈 - #32310 - #30755 - #32371 - #32372 - #30756 - #32373 - #32374 - #32375 - #30898 - #32376 - #32377 - #32378 - #32379
…t-templates/multi-select-combobox
MultiSelectComboboxhad no consumer inside a dialog until the chat project dialogs in the PRs above. Inside a Radix dialog it loses keyboard focus and closes the dialog:valuepassed on the first render was not selected until a later render, so a dialog that opens with saved values showed an empty field first.What to look at: this changes a shared component with five other consumers. Outside a dialog, the first Escape now closes the list and keeps focus in the input, where it used to blur the input; a second Escape blurs it. The Tab fix has no unit test. It was checked in Chromium with a temporary story.
Split out of #30756 and #30898, so the shared component can be reviewed apart from the feature.
Stack (merge top to bottom):