You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
textarea: Enter should insert a newline instead of submitting #46
The native multiline <textarea> binds plain Enter to Submit and Shift+Enter to Newline. A normal multiline editor therefore cannot insert a newline with Enter. If no onSubmit listener is registered, Enter visibly does nothing.
This is present in 0.6.0, 0.7.0, and current main:
Focus it and press Enter in the middle of the buffer.
Expected: the current selection is replaced by \n, the caret moves after it, and onChange fires.
Actual: Submit runs; the value and caret do not change.
Suggested contract
<input>: Enter emits submit.
<textarea>: Enter invokes Newline.
Shift+Enter may also invoke Newline.
If chat/composer behavior is needed, expose it as an explicit textarea prop rather than making it the multiline default.
An application-side onSubmit workaround is not correct: the submit payload contains the full value but no caret/selection offsets, so JavaScript cannot insert at the native selection while preserving native undo, IME, and caret behavior.
Acceptance
Plain Enter in a textarea replaces the current selection with one newline.
The edit participates in native undo/redo and emits one change event.
Plain Enter in an input still emits submit.
Native tests cover insertion at the middle of a buffer and replacement of a selected range.
Activity
Make Enter insert a newline in textarea unless onSubmit is set.
release: @gpuix/[email protected] and @gpuix/[email protected]