Skip to content

feat(ui): chat input refocus after model responses#2570

Merged
daryllimyt merged 3 commits intomainfrom
codex/fix-chat-input-refocus-after-model-response
Apr 30, 2026
Merged

feat(ui): chat input refocus after model responses#2570
daryllimyt merged 3 commits intomainfrom
codex/fix-chat-input-refocus-after-model-response

Conversation

@daryllimyt
Copy link
Copy Markdown
Contributor

@daryllimyt daryllimyt commented Apr 26, 2026

Motivation

  • The chat composer was disabled while the model was responding but did not restore focus to the message textarea when it became enabled again, forcing users to click the input before sending follow-ups.
  • Improve UX by automatically restoring focus after a disabled->enabled transition and keep disabled-state logic consistent across input and submit controls.

Description

  • Added a scoped promptInputContainerRef to the prompt area and attached it to the prompt container element.
  • Introduced isInputDisabled and wasInputDisabledRef and a useEffect that detects the disabled->enabled transition and focuses the scoped textarea via querySelector when the composer becomes enabled.
  • Replaced scattered disabled checks with isInputDisabled on the PromptInputTextarea and the PromptInputSubmit so the textarea and submit button remain in sync.
  • Modified frontend/src/components/chat/chat-session-pane.tsx to implement the changes.

Testing

  • Ran pnpm -C frontend exec biome check src/components/chat/chat-session-pane.tsx which initially reported formatting differences and failed.
  • Ran pnpm -C frontend exec biome check --write src/components/chat/chat-session-pane.tsx which applied formatter fixes successfully.
  • Re-ran pnpm -C frontend exec biome check src/components/chat/chat-session-pane.tsx which completed with no errors.

Codex Task


Summary by cubic

Restores focus to the chat input after the model finishes responding, so users can immediately type follow-ups. Also unifies the composer’s disabled state across the textarea and submit button.

  • Bug Fixes
    • Added a scoped promptInputContainerRef and an effect to focus the textarea on a disabled→enabled transition.
    • Introduced isInputDisabled to keep the textarea and submit button in sync.

Written for commit c5f8a03. Summary will update on new commits.

@zeropath-ai
Copy link
Copy Markdown

zeropath-ai Bot commented Apr 26, 2026

No security or compliance issues detected. Reviewed everything up to ea8960f.

Security Overview
Detected Code Changes

| Change Type | Relevant files

... (code changes summary truncated to fit VCS comment limits.)

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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: c5f8a03f24

ℹ️ 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".

Comment thread frontend/src/components/chat/chat-session-pane.tsx
@daryllimyt daryllimyt force-pushed the codex/fix-chat-input-refocus-after-model-response branch from eb3d815 to 2f2fdd1 Compare April 30, 2026 16:46
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: 2f2fdd1f4d

ℹ️ 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".

Comment thread frontend/src/components/chat/chat-session-pane.tsx
@daryllimyt daryllimyt changed the title Fix chat input refocus after model responses feat(ui): chat input refocus after model responses Apr 30, 2026
@daryllimyt daryllimyt merged commit 4ee5490 into main Apr 30, 2026
11 checks passed
@daryllimyt daryllimyt deleted the codex/fix-chat-input-refocus-after-model-response branch April 30, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant