Repository navigation
Description
What's the problem?
The overall feedback textarea (GlobalCommentComposer) in the plan review UI does not respond to keyboard shortcuts. To submit the review, users have to take their hands off the keyboard, mouse to the submit button below the textarea, and click it. That break feels heavy for a tool whose workflow is "type a thought, send it," especially since per-annotation popovers (AnnotationPopover) already support CMD/CTRL+Enter to save via the useSubmitOnCmdEnter hook — so the inconsistency is felt every time a reviewer adds an inline comment, then drops to the bottom box and reaches for the mouse.
Proposed solution
When the overall feedback textarea (packages/annotation/src/GlobalCommentComposer.tsx) has focus, CMD+Enter (macOS) / CTRL+Enter (Linux/Windows) should trigger the same submit action as clicking the submit button — i.e. invoke whatever the submit button would do in its current state (the label and behavior already track state per plan-review-design.md's "one contextual button" rule: it accepts when there is no feedback, requests changes when there is).
Implementation sketch:
- Reuse the existing
useSubmitOnCmdEnterhook frompackages/annotation/src/useSubmitOnCmdEnter.ts— same pattern used byAnnotationPopover.tsx:43. - Wire
submission.submit(the same callback used bySubmitBar'sonClick) into the textarea'sonKeyDown. - Respect the existing disabled state — do not fire when
submission.submittedorsubmission.submittingis true (matches the submit button'sdisabledlogic inSubmitBar.tsx:62). - Add a vitest browser-mode test alongside
useSubmitOnCmdEnter.test.ts/ the existing App tests covering: (a) CMD+Enter submits when textarea is focused, (b) CTRL+Enter submits when textarea is focused, (c) no submit whilesubmitting/submitted, (d) plain Enter still inserts a newline.
The shortcut should only fire while the textarea is focused (per the user's request) — no global document-level listener.
Alternatives you considered
- Global hotkey that submits regardless of focus. Rejected: surprises users who are typing inside an inline annotation popover, where CMD+Enter already means "save this annotation."
- Plain Enter to submit (Slack/iMessage style). Rejected: the textarea explicitly supports multi-line feedback and the placeholder ("Add overall feedback…") invites prose — stealing Enter for submit breaks paragraph entry.
Additional context
Today's CMD+Enter wiring for reference:
- Hook:
packages/annotation/src/useSubmitOnCmdEnter.ts - Existing consumer:
packages/annotation/src/AnnotationPopover.tsx:43,108 - Target component:
packages/annotation/src/GlobalCommentComposer.tsx - Submit pipeline (the callback to invoke):
SubmissionState.submitinpackages/annotation/src/SubmitBar.tsx:12
Activity
feat: add global feedback submit shortcut (#116)