fix(ui): Focus first text input by default#4134
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@BugBot review |
PR SummaryMedium Risk Overview Removes scattered Reviewed by Cursor Bugbot for commit 9261f15. Bugbot is set up for automated code reviews on this repo. Configure here. |
apps/sim/app/workspace/[workspaceId]/settings/components/integrations/integrations-manager.tsx
Show resolved
Hide resolved
|
@BugBot review |
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 9261f15. Configure here.
Greptile SummaryThis PR centralises modal auto-focus by introducing a shared All remaining findings are P2 style/documentation items that do not block merge. Confidence Score: 5/5Safe to merge — all findings are non-blocking P2 style and documentation issues. The core auto-focus utility is well-written (visibility guard, caret placement, apps/sim/app/workspace/[workspaceId]/settings/components/integrations/integrations-manager.tsx (hook ordering), apps/sim/components/emcn/components/modal/modal.tsx (ModalTabsContent JSDoc) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Modal / SModal opens] --> B[onOpenAutoFocus fires on DialogContent]
B --> C[focusFirstTextInput]
C --> D{Find first visible\ntext input in dialog}
D -- found --> E[focus + caret at end]
D -- not found --> F[Radix default focus runs]
G[ModalTabs tab changes] --> H[handleValueChange]
H --> I[requestAnimationFrame]
I --> J{Find active tabpanel\ndata-state=active}
J -- found --> K[focusFirstTextInputIn panel]
J -- not found --> L[no-op]
M[UserInput mounts] --> N[requestAnimationFrame on mount]
N --> O[textareaRef.current?.focus]
P[Panel activeTab → copilot] --> Q[setTimeout 0ms]
Q --> R[document.querySelector textarea]
R --> S[textarea?.focus]
|

Summary
Currently modals and modal tabs don't auto-focus on the first text input. This is annoying for the user.
Modified both emcn modal and modal tabs to by default auto-focus on the first available user input.
Also added focusing logic for the copilot sidebar and mothership tasks to auto focus.
Fixes #(issue)
Type of Change
Testing
Checklist
Screenshots/Videos