code.pyret.org icon indicating copy to clipboard operation
code.pyret.org copied to clipboard

Enter submits modals.

Open asolove opened this issue 1 year ago • 1 comments

Resolves #277.

We already auto-focus the submit button for modals with no inputs, so enter already works there. With this change, if the modal has text inputs, hitting enter while focused on one of these text inputs will also immediately try to submit.

If we ever add modals that have inputs where enter should do something else (like a multi-line textarea comment box), we'll need to ensure that input captures and does not bubble the enter event, so that it doesn't trigger this.

asolove avatar Jan 21 '24 14:01 asolove

This code as-is obviously works :) But for future robustness -- would it be easier to add an option enterSubmits: boolean that decides whether to add this submit-on-press-Enter behavior?

blerner avatar Apr 18 '24 16:04 blerner

reviewed w/Joe

ds26gte avatar Apr 29 '24 18:04 ds26gte