Skip to content

fix(chat): focus the composer when opening a new or existing chat - #6683

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/focus-new-chat-input
Aug 13, 2026
Merged

fix(chat): focus the composer when opening a new or existing chat#6683
waleedlatif1 merged 1 commit into
stagingfrom
fix/focus-new-chat-input

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Clicking "New chat" or opening a chat from the sidebar left focus on the link, so the composer's mount-time focus was skipped and you had to click into the textarea before typing
  • The mount effect only focused when document.activeElement was body/documentElement; it now focuses unless the active element is a real text-entry field (input/textarea/select/contenteditable), so it takes focus from a link or button but never steals it from another field

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 13, 2026 11:15pm

Request Review

@cursor

cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Localized UX/focus behavior in the chat composer with no auth, data, or API changes.

Overview
Opening a chat from the sidebar or New chat often left focus on the clicked link, so the composer mount logic did not move focus and users had to click the textarea before typing.

The mount-time focus effect in user-input.tsx no longer only runs when activeElement is body/documentElement. It now focuses the composer whenever the page has focus unless the active element is a real text-entry target (input, textarea, select, or contenteditable), via a new isTextEntry helper. Sidebar links and buttons are overridden; other fields are not.

Reviewed by Cursor Bugbot for commit f45c396. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR updates the chat composer’s mount-time focus behavior so opening a new or existing chat transfers focus from sidebar links or buttons while preserving focus in active text-entry fields.

  • Adds a helper recognizing inputs, textareas, selects, and contenteditable elements.
  • Retains the document-focus guard and focuses the composer on the next animation frame when no text-entry field owns focus.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified.

The changed focus effect preserves focus for active native and contenteditable fields while correctly transferring focus from the sidebar control during the reachable composer remount flow.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx Broadens composer autofocus from neutral document focus to non-text-entry controls without revealing a concrete regression in current mounting paths.

Reviews (1): Last reviewed commit: "fix(chat): focus the composer when openi..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 4ff339e into staging Aug 13, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/focus-new-chat-input branch August 13, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant