Skip to content

feat(web): Cmd/Ctrl+Enter posts a comment, and comment drafts survive a reload (E9) - #388

Merged
PastaPastaPasta merged 2 commits into
masterfrom
feat/e9-composer-keys
Oct 4, 2026
Merged

PastaPastaPasta merged 2 commits into
masterfrom
feat/e9-composer-keys

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

What

  • Cmd+Enter / Ctrl+Enter in the issue and PR comment boxes posts the comment, as GitHub does. In an inline review comment box it runs the box's main action: "Start a review" or "Add review comment" while a review is in progress, otherwise "Add comment".
  • Comment drafts survive a reload. An unsent issue or PR comment is kept in this browser, per signed-in identity and per issue or PR, until it is posted or emptied, and for at most two weeks. "Sign out & forget key" removes them.

Why

Power-user basics from the roadmap. Losing a long comment to a reload or a closed tab is a common complaint, and reaching for the mouse to post breaks the flow.

How

  • MarkdownEditor takes onSubmit. Cmd/Ctrl+Enter in the field calls it, but not while an input method is composing. The field also gets aria-keyshortcuts. The shortcut is wired only where the Comment button would be enabled for the viewer's situation (not when composing is blocked or the viewer is locked out). The action runs its own checks (empty, too long, funds) as the button does.
  • lib/view/draft-text.ts: useDraftText(key) is useState backed by localStorage (forge:draft:v1:<identity>:<repoId>:<targetId>:comment). An empty text removes the entry. A damaged or expired entry reads as no draft, and storage errors leave the draft in memory. At most 100 drafts are kept, and expired ones are dropped as drafts are written.
  • No double posts: while a post's outcome is unknown, nothing is stored. A reload after an unconfirmed write therefore can't bring the text back to be posted a second time. A post that sent nothing stores the text again.
  • Another identity in the same browser never sees a draft, so it can't post it under its own name.
  • Private repositories, and signed out: the key is null, so nothing is written. Their text is encrypted on Platform, and a plaintext copy on disk would outlive the session.

How tested

  • Reviewed with the code-review skill. The fixes are in the second commit: per-identity keys, cleared with a forgotten key; nothing stored during an unconfirmed write; a bounded store; the inline shortcut gated like its button; and public repos only, failing closed.

  • tsc, eslint, and the full vitest run (345 files pass). The new draft-text.test.tsx covers store, clear, expiry, a damaged entry, restore after a remount per target, no storage without a key, and the shortcut (Enter alone does nothing).

  • Live on devnet sakura with this branch's static build, PR Publish the browse index on ordinary pushes #4 in scratch repo 2D3Akz31nwDupidzP4hJ16s8tqjByYe55Vtg1iQN1MrZ/mp-merge-a:

    • A typed comment is still there after a reload.
    • Ctrl+Enter posted it, and the comment shows in the conversation.
    • The box was empty afterwards, including after another reload.
  • Evidence: /Users/pasta/workspace/dash-forge-qa/evidence/p0/merge-power/e9-composer-keys/ (screenshots and video) and the script e9-composer-keys.mjs.

Limits

  • As on GitHub, a restored draft turns "Close" into "Close with comment". The text is in the box.

  • Edit boxes, the review summary and the new-issue and new-PR forms don't keep drafts. The review summary has no shortcut, because submitting a review needs its verdict confirmed.

🤖 Generated with Claude Code

… a reload

The issue and PR comment boxes and the inline review comment box run their main action on Cmd+Enter or Ctrl+Enter, as GitHub does. An unsent issue or PR comment is kept in this browser per issue or PR, cleared once posted, and dropped after two weeks. A private repository's drafts are never written to storage.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 222ee95b-7faf-4aa5-9a2a-38b2d00004cb
📥 Commits

Reviewing files that changed from the base of the PR and between e5ba904 and f8ff6d9.

📒 Files selected for processing (7)
  • forge-web/components/repo/inline-comments.tsx
  • forge-web/components/repo/issue-bits.tsx
  • forge-web/components/repo/issue-content.tsx
  • forge-web/components/repo/pull-content.tsx
  • forge-web/lib/auth/controller.ts
  • forge-web/lib/view/draft-text.test.tsx
  • forge-web/lib/view/draft-text.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ent, bound the store

Drafts are keyed by the signed-in identity and only kept for public repositories; Sign out & forget key removes them. While a post's outcome is unknown nothing is stored, so a reload after an unconfirmed write cannot bring the text back to be posted twice; a post that sent nothing keeps it again. At most 100 drafts are kept and expired ones are dropped as drafts are written. Cmd/Ctrl+Enter in an inline comment does nothing while its button is disabled.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@PastaPastaPasta
PastaPastaPasta merged commit 48e82ee into master Oct 4, 2026
15 of 17 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the feat/e9-composer-keys branch October 4, 2026 22:31
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