feat: add Enter key to confirm message editing#2812
Open
Br1an67 wants to merge 2 commits intoChainlit:mainfrom
Open
feat: add Enter key to confirm message editing#2812Br1an67 wants to merge 2 commits intoChainlit:mainfrom
Br1an67 wants to merge 2 commits intoChainlit:mainfrom
Conversation
Add onKeyDown handler to the edit textarea so Enter submits the edit (matching new message behavior) while Shift+Enter still creates a newline.
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: AddedonKeyDownhandler to the edit textarea — Enter confirms, Shift+Enter inserts a newlineTesting
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.