Skip to content

feat: add Enter key to confirm message editing#2812

Open
Br1an67 wants to merge 2 commits intoChainlit:mainfrom
Br1an67:fix/issue-2120-enter-confirm-edit
Open

feat: add Enter key to confirm message editing#2812
Br1an67 wants to merge 2 commits intoChainlit:mainfrom
Br1an67:fix/issue-2120-enter-confirm-edit

Conversation

@Br1an67
Copy link
Contributor

@Br1an67 Br1an67 commented Mar 1, 2026

What

Add Enter key support to confirm edited messages, matching the behavior of new message submission.

Closes #2120

Why

Currently, editing a message requires clicking the Confirm button. New messages use Enter to submit and Shift+Enter for newlines. This inconsistency is confusing.

Changes

  • frontend/src/components/chat/Messages/Message/UserMessage.tsx: Added onKeyDown handler to the edit textarea — Enter confirms, Shift+Enter inserts a newline

Testing

  • Manual: Enter submits edit, Shift+Enter adds newline, Escape can still cancel via Cancel button

Summary by cubic

Press Enter to confirm message edits, matching new message submission. Addresses #2120; Shift+Enter inserts a newline, and Enter is ignored during IME composition or when editing is disabled.

Written for commit b43c5e5. Summary will update on new commits.

Add onKeyDown handler to the edit textarea so Enter submits the edit
(matching new message behavior) while Shift+Enter still creates a
newline.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 1, 2026
@dosubot dosubot bot added the frontend Pertains to the frontend. label Mar 1, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/src/components/chat/Messages/Message/UserMessage.tsx">

<violation number="1" location="frontend/src/components/chat/Messages/Message/UserMessage.tsx:113">
P2: Enter-to-submit is attached to onKeyDown without IME composition guard, so Enter during IME composition can trigger premature message edit submission. AutoResizeTextarea already supports onEnter with composition protection; use that instead or guard with e.isComposing.</violation>

<violation number="2" location="frontend/src/components/chat/Messages/Message/UserMessage.tsx:114">
P2: Enter key submission bypasses the disabled guard (loading/askUser), allowing edits while interaction is meant to be blocked.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

- Guard against IME composition with e.nativeEvent.isComposing to prevent
  premature submission during CJK input
- Check disabled state (loading/askUser) to match the Confirm button behavior
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Pertains to the frontend. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enter for "Confirm" when editing messages

2 participants