Fix inconsistent Enter key behavior in Textbox for multiline inputs#13365
Fix inconsistent Enter key behavior in Textbox for multiline inputs#13365Khushi-Roy-123 wants to merge 3 commits intogradio-app:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8b32b04. Configure here.
| } | ||
| await tick(); | ||
| oninput?.(value); | ||
| } |
There was a problem hiding this comment.
Function body indentation is incorrect and inconsistent
Low Severity
The handle_keypress function body is indented at the same level as the function declaration (1 tab), and the closing brace is at 0 tabs. Every sibling function (handle_select, handle_scroll, etc.) has its body at 2 tabs and closing brace at 1 tab. This makes the code visually appear to close at the module level rather than the <script> block level.
Reviewed by Cursor Bugbot for commit 8b32b04. Configure here.
There was a problem hiding this comment.
I’ve updated the handler to ensure:
- oninput is always triggered (even on Shift+Enter in multiline)
- Enter behavior remains consistent across input types
Also aligned indentation with surrounding code style.
Pushing updates soon
8b32b04 to
6bbf895
Compare
|
Update pushed with clean implementation. This change ensures:
Happy to adjust if a different UX direction is preferred. |


Problem
Enter key does not trigger submit for multiline Textbox (lines > 1), while Shift+Enter does.
Cause
Conditional logic in handle_keypress restricts Enter submission to single-line inputs.
Fix
Result
Consistent behavior across all Textbox configurations.
Fixes #13354
Note
Medium Risk
Changes core
Textboxkey handling so plain Enter always triggersonsubmit, which may alter UX for multiline textareas and affect flows that previously relied on Enter inserting a newline.Overview
Unifies
TextboxEnter key behavior by simplifyinghandle_keypress: plain Enter now always prevents default and callsonsubmit, regardless oflines/max_linessettings.Shift+Enter is preserved for inserting a newline, and the component still calls
oninputafter key handling.Reviewed by Cursor Bugbot for commit 6bbf895. Bugbot is set up for automated code reviews on this repo. Configure here.