-10

To preface, I am aware that there is a bug report for this feature, and it has been marked as status-bydesign.

I am raising a feature request as this has snagged me on more than one occasion - I am editing a post's title, go to hit the shift or backspace key but hit enter instead, submitting my (currently shoddy) edit. I then need to re-edit the post to finish what I was meant to be typing in the first place, as there is no way to edit an edit (that I am aware of at least).

While I know it doesn't clutter up the edit history of a post (so unless someone catches me between edits I can get away with it), it frankly makes for a very irritating user experience.

I understand that hitting enter on an input is expected behaviour of HTML forms, but it is suggested that this shouldn't happen in forms with multiple fields, and I am inclined to agree from a user experience point - having the enter key submit a form when I'm not done everywhere is very annoying. Not to mention that this is only a feature of <input> tags, so doesn't happen when hitting enter on the Body <textarea> within the same form - I hate inconsistencies like this, but maybe that's just me.

I also know "potential accessibility concerns" were brought up in the above-linked bug report, but I don't understand what exactly that refers to - I don't understand how suppressing this "enter submits the form" functionality would raise accessibility problems.


I am submitting this as a feature request as I fully believe that this needs to be implemented from a user experience standpoint, but I am happy to be convinced otherwise.

17
  • 11
    For me, it would be really annoying if the site broke the expected behavior of HTML forms. I expect that hitting enter on a field will submit the form, and when it doesn't happen is distracting.
    – yivi
    Commented Apr 8, 2019 at 11:36
  • "hitting enter on a field will submit the form" - but this behaviour is only on the Title field. Having it only apply to one of the two fields is also distracting - if one behaviour happens on one field, I think it should happen on all fields, otherwise IMO it is frustratingly inconsistent. I want to know what to expect when using a site - not everyone knows the HTML Spec for input tags, so there is nothing to suggest to them that this is intended behaviour and not a bug. Commented Apr 8, 2019 at 11:44
  • 6
    No, it also works on the tags field and on the "edit summary" field. Logically it doesn't work on the main editor field, since "enter" has a different meaning there, as expected. (Basically, it happens in all input fields bar the textarea, where making enter submit the form would be very wrong).
    – yivi
    Commented Apr 8, 2019 at 11:45
  • Changing the Title, Body and Tags fields to submit on ctrl/cmd + enter would be preferable in my opinion, for consistency and ease of use. It stops clumsy people (like myself) from submitting bad edits, and keeps (at least some of) the input tag's intended functionality. Commented Apr 8, 2019 at 11:48
  • Fair enough, I had forgotten about the tags field. My point still stands though that it isn't consistent across all fields. Commented Apr 8, 2019 at 11:49
  • It's consistent accross all non-textarea fields (three of them). Which makes sense. In a text-area you expect enter to add newlines. In any other field, to submit the form.
    – yivi
    Commented Apr 8, 2019 at 11:50
  • According to the w3 spec, "When there is only one single-line text input field in a form, the user agent should accept Enter in that field as a request to submit the form" (found from this answer. There is more than one input field, so surely this doesn't apply? Commented Apr 8, 2019 at 12:05
  • 2
    That's the oldest HTML specification. We are 3 versions over that (if you count 4 and 4.1 as one version each). The current version, doesn't have such stipulation w3.org/TR/html52/sec-forms.html#implicit-submission
    – Braiam
    Commented Apr 8, 2019 at 14:04
  • @Braiam fair enough, I didn't know that - I. I guess I'll just have to make a TamperMonkey script to suppress this on my own machine then... Commented Apr 8, 2019 at 14:11
  • @JamesWhiteley you linked to a very very old spec, for HTML 2.0. It uses should to describe desired behaviour and doesn’t prevent anything. Commented Apr 8, 2019 at 14:12
  • @JamesWhiteley Much more relevant is the implicit form submission section of the HTML 5 standard which encourages browsers to implement implicit form submission. Commented Apr 8, 2019 at 14:13
  • 2
    The living HTML standard of the WhatWG has a very similar section; basically, implicit submission is allowed and encouraged. Hitting ENTER in the title field submits the form because that’s how browsers work and are supposed to work. Commented Apr 8, 2019 at 14:18
  • @MartijnPieters I got that spec from a SO post linked in my linked post... I didn't think to check any later versions, my apologies. Commented Apr 8, 2019 at 14:19
  • 2
    Finally, this behaviour is there because it gives a better user experience. Especially for those that can't use a mouse. See tjvantoll.com/2013/01/01/… Commented Apr 8, 2019 at 15:04
  • @MartijnPieters that's the argument I have most issue with to be honest - how is tabbing four times from the Title field so much more difficult than tabbing three times from the Body field? The shortcut of "tab until you get to what you want" is tried and true, so why is this argument such a big deal? Especially when you can't use the enter key to submit from the Body textarea. Commented Apr 8, 2019 at 15:10

1 Answer 1

10

This behaviour is dictated by the user-agent. E.g. the browser

Messing with this would be counter productive.

Usually, by using the browser we are trained to expect certain behaviour. E.g. hitting enter on any text field that doesn't accept accept newlines submits the form. This happens not only on Stack Overflow question editor, but on any other form. You can test it here, for example:

<form action="https://www.example.com/">
<label for="one">one <input id="one" type="text"></label><br>
<label for="two">two <input id="two" type="text"></label><br>
<label for="three">three <input id="three" type="text"></label><br>
<label for="four">four <input id="four" type="text"></label><br>
<input type="submit" value="submit if you want">
</form>

If the developers took steps to prevent this default behaviour, it would be confusing.

Of the 4 fields that comprise the question editor, 3 of them will submit the question if you click enter. The only one that doesn't submit is the big textarea, where logically enter equals "new line".

The only exception to this is the tag editor, where you can hit enter once to accept a tag autocomplete suggestion without submitting the form.

IMO, this is fine as it is and this FR should be .

1
  • 1
    Another reason not to suppress the enter key submitting: it would severely hinder accessibility. Users that can't use a mouse would have a real hard time submitting the form. See tjvantoll.com/2013/01/01/… Commented Apr 8, 2019 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .