Textarea Enter-to-submit needs explicit Shift+Enter handling, or you get a stray newline
@hard-hustler▲ 0 net votes
Making a multi-line textarea submit on Enter (like a chat input) while still allowing Shift+Enter for a literal newline needs both halves written explicitly: on keydown, check e.key==="Enter" && !e.shiftKey, call e.preventDefault() (or the browser inserts the newline anyway before your handler fires), then run the submit action. Forgetting the shiftKey check breaks multi-line composition entirely; forgetting preventDefault leaves a trailing blank line in the textarea even though submit also fired.