Skip to content

improvement(ux): submit on Enter in chip modals and advance table rows#5781

Merged
waleedlatif1 merged 4 commits into
stagingfrom
worktree-enter-key-default-action
Jul 20, 2026
Merged

improvement(ux): submit on Enter in chip modals and advance table rows#5781
waleedlatif1 merged 4 commits into
stagingfrom
worktree-enter-key-default-action

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • ChipModal now fires its footer's primary action when Enter is pressed in any single-line input/email field — Enter-to-submit goes from opt-in (a per-field onSubmit most modals forgot to wire) to automatic across every chip modal. Guards IME composition and respects the primary's disabled state.
  • Enter never triggers a destructive primary action from a text field — ChipModalFooter skips registering variant: 'destructive' primaries. Closes the latent "Enter-to-delete from a textbox" footgun.
  • Added a submitOnEnter opt-out for config-knob fields inside larger forms (applied to the scheduled-task "Number of runs" input so Enter doesn't submit the modal prematurely).
  • Workflow Table sub-block: pressing Enter in a cell now advances to the same column in the next row (spreadsheet-style), matching the data-tables grid convention. Skips while a tag/env-var dropdown is open (Enter selects there) and during IME composition. Previously Enter was a no-op.

Type of Change

  • Improvement / enhancement

Testing

Tested manually. tsc (emcn + app) and full lint:check green. Not covered by automated tests (emcn's test env is node-only, no jsdom).

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 Jul 20, 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 Jul 20, 2026 11:24pm

Request Review

@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UX-focused changes in shared modal primitives and a workflow table editor; behavior is guarded (disabled state, destructive opt-out, IME) with limited blast radius beyond chip modals.

Overview
Chip modals now submit on Enter in single-line input/email fields by wiring the footer's primary action through shared context—no per-modal onKeyDown or field onSubmit needed. Enter respects the primary's disabled state, skips IME composition, and never fires destructive primaries from a text field. Nested knobs can opt out with submitOnEnter={false} (e.g. scheduled task "Number of runs").

Several modals (OAuth connect, rename document, create workspace) drop redundant body-level Enter handlers in favor of the shared behavior.

The workflow editor table sub-block treats Enter as move focus to the same column, next row (with guards for tag/env dropdowns and stale refs after row delete).

Reviewed by Cursor Bugbot for commit 45d46d9. Configure here.

Comment thread packages/emcn/src/components/chip-modal/chip-modal.tsx
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds consistent Enter-key behavior to chip modals and workflow tables. The main changes are:

  • Submits non-destructive chip-modal actions from single-line fields on Enter.
  • Guards disabled actions and IME composition, with a field-level opt-out.
  • Removes redundant Enter handlers from modal consumers.
  • Advances workflow table focus to the next row on Enter.

Confidence Score: 5/5

This looks safe to merge.

  • The primary action is registered before paint.
  • Disabled and destructive actions remain guarded.
  • No blocking issues were found in the updated code.

Important Files Changed

Filename Overview
packages/emcn/src/components/chip-modal/chip-modal.tsx Adds modal-scoped primary-action registration and automatic Enter submission for single-line fields.
apps/sim/app/workspace/[workspaceId]/components/connect-oauth-modal/connect-oauth-modal.tsx Removes the local Enter handler and uses the shared chip-modal behavior.
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/rename-document-modal/rename-document-modal.tsx Removes redundant local Enter submission handling.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/recurrence-section.tsx Opts the recurrence count field out of automatic modal submission.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/table/table.tsx Adds next-row focus on Enter and removes disconnected input and overlay refs.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/create-workspace-modal/create-workspace-modal.tsx Replaces the local Enter handler with shared chip-modal submission.

Reviews (4): Last reviewed commit: "fix(table): clean up cell refs on unmoun..." | Re-trigger Greptile

Comment thread packages/emcn/src/components/chip-modal/chip-modal.tsx
- stopPropagation on field Enter-submit so a parent onKeyDown can't re-fire the primary (double OAuth connect, etc.)
- register primary via useLayoutEffect so it's set before paint (no null-Enter window)
- drop now-redundant parent Enter handlers in connect-oauth/create-workspace/rename-document modals
@waleedlatif1
waleedlatif1 force-pushed the worktree-enter-key-default-action branch from 0b3ed5d to 79828f4 Compare July 20, 2026 23:12
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Focusing an empty cell auto-opens the tag dropdown; without closing it a follow-up Enter inserts a tag instead of navigating down the column.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

- delete inputRefs/overlayRefs entries when a cell detaches so deleting a row can't leave stale position-keyed entries
- guard Enter advance with isConnected so a stale ref can never steal focus into a detached node
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 45d46d9. Configure here.

@waleedlatif1
waleedlatif1 merged commit ae6a363 into staging Jul 20, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the worktree-enter-key-default-action branch July 20, 2026 23:39
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