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
Pressing the Enter key while you're in a regular input field will submit the form. This means that if you're typing a message and fat-finger the Enter key, you might have made an irreversible change.
This is not so much of an issue when creating an issue since it can be changed later, but it's a problem when merging PRs and saving file changes on the file edit page. Both of them create commits, possibly on the main branch.
Instead of adding annoying prompts, we have 2 options:
disable the enter key in issue/PR/commit title fields
re-map the enter key to act as a tab in those fields, so it will merely move the cursor to the textarea
I think the latter is preferable because the former would just feel like the enter key is suddenly broken.
Either way, the form will still be submittable via ctrl+enter as it already is.
The solution probably looks like:
delegate(document,'the right selector','keypress',e=>{if(eisenterkey)select('textarea',e.delegateTarget.form).focus();})
Reacted by yakov116, darkred, Florent, altrisi and Benedikt Straub
changed the title [-]Avoid unwanted early form submissions by re-mapping the enter key[/-][+]Avoid accidental form submissions by re-mapping the enter key[/+]on Apr 17, 2021
Activity
[-]Avoid unwanted early form submissions by re-mapping the enter key[/-][+]Avoid accidental form submissions by re-mapping the enter key[/+]darkred commentedon Apr 18, 2021
@fregante
I made PR #4252 following your solution (adding
e.preventDefault())and renamed the feature as
avoid-accidental-submissions.[-]Avoid accidental form submissions by re-mapping the enter key[/-][+]Avoid accidental form submissions[/+]