I have noticed recently that when composing comments, pressing the return key submits the comment as is. This behaviour differs from that when composing replies. I am using Firefox. As I frequently press return, I find that when writing comments I have to keep opening up the inadvertently submitted comment for editing. I don't recall this happening more than a few days ago. So, at least one user finds this "feature" annoying and would like this bug squashed. Is it possible to ensure that comments can only be submitted by pressing the "add comment" button?

  • 6
    $\begingroup$ meta.stackexchange.com/questions/63644/… $\endgroup$
    – Aryabhata
    Commented Sep 8, 2010 at 14:29
  • 2
    $\begingroup$ The workaround mentioned in that link is to use shift+enter to go to the next line. $\endgroup$
    – Larry Wang
    Commented Sep 8, 2010 at 22:34
  • $\begingroup$ I posted a possible solution on the meta.SO thread. Robin, would my suggestion, if implemented, work for you? $\endgroup$
    – user856
    Commented Dec 8, 2010 at 6:11
  • 3
    $\begingroup$ I have had the problem a number of times, and not only recently. It is quite annoying, since then for edits the $5$ minute countdown is in effect. Several times I have had to delete a comment, and start again. $\endgroup$ Commented Aug 4, 2011 at 4:33
  • $\begingroup$ Testing shift+enter: Next line Two lines $\endgroup$
    – mr_e_man
    Commented Mar 23, 2023 at 19:10

4 Answers 4


Let me relate a related thing that happened to me.

Before Microsoft's Internet Explorer there was Netscape, and I used Netscape for accessing web-based email. You clicked the mouse on a submit button to send the email. While composing the email I would edit the text until it was ready by deleting bits of text, rewriting bits and splitting long sections into paragraphs by using the enter key, but to do all this I moved the cursor around the textarea by clicking the mouse on the part I wanted to edit.

Then came Internet Explorer and I began to use IE instead of Netscape, but when I was editing an email to split a long section into paragraphs by inserting a newline I would click the mouse at the beginning of the line and then press Enter (and you can guess what happened). I thought I had clicked the mouse at the beginning of the line but I had actually clicked a few pixels too far to the left, so when I pressed Enter the active item was not the textarea but the webpage so pressing Enter submitted the email and sent a half-baked email. At the time I didn't realise what had happened, because I was familiar with Netscape which didn't have this "pressing Enter to submit" behaviour, so I started again and the same thing happened, and then again but this time I was deleting a character but pressing delete outside of the textarea activated the browsers back button, although I didn't realise it at the time. All in all I don't know how many half-baked emails I sent in succession to that person, but I never heard from them again so I reckon they were not impressed.

To sum up, I think it is absolutely shocking user-interface design to have "pressing Enter to submit" behaviour when textareas are involved where the Enter key is used for creating new lines and paragraphs. 4 paragraphs in this long spiel.


Interestingly, as of June 22 Enter no longer adds comments on the main site for Japanese Language & Usage. The change was in response to problems it caused for users of Input Method Editors, a point that was raised on meta.SO last September.

  • 5
    $\begingroup$ Okay... (for SE overlords) so why can't the "Enter functionality" of comments be a user-adjustable setting for SE sites? $\endgroup$ Commented Aug 3, 2011 at 5:44
  • 5
    $\begingroup$ I imagine that these one-letter comments that were produced with that input method were even worse than what Robin Chapman appears to have managed. Probably Jeff wanted to avoid having to equip his avatar with even more risen hair... Anyway: I'm pretty happy with this script $\endgroup$
    – t.b.
    Commented Aug 3, 2011 at 6:18

It is actually a new feature. I don't think there's any plan to make the old behavior accessible.

Edit: there is an easily installable Greasemonkey script to change this behavior, that works with Firefox and Chrome, here. Instructions at the following link with screenshots:


  • 16
    $\begingroup$ A bug that's a "feature". It's definitely evil though :-( $\endgroup$ Commented Sep 8, 2010 at 15:27
  • 4
    $\begingroup$ @Robin: You gotta complain on meta.stackoverflow.com (which would be closed as duplicate of meta.stackexchange.com/questions/63644/… anyway). We don't control the backend code :(. $\endgroup$
    – kennytm
    Commented Sep 8, 2010 at 15:46
  • 1
    $\begingroup$ When you say that the enter key is disabled by this script in the comment field, do you mean that pressing enter will have no effect at all, or that it will have the usual editing effect of bringing the cursor to a new line in the textarea? If the former, it seems to be only a half solution. $\endgroup$
    – JDH
    Commented Dec 10, 2010 at 1:23
  • $\begingroup$ @JDH : Latter . $\endgroup$
    – kennytm
    Commented Dec 10, 2010 at 5:14

Just for your information, this is the background on how the internet works.

On the Internet, there are two basic forms of text input, the <textarea> element (which is specifically designed for long multiline input) and the <input> element. (which also handles radio-buttons etc.)

if we look at the HTML 2.0 specificaction dated 1995-09-22, more specifically the Form Submission section, you will notice the following passage:

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.

(this is a reference to the <input> element)

When Microsoft made Internet Explorer 4, they implemented this to the letter of the law, resulting in different behavior, based on the occurance of one or more <input> elements in the form.

Now, while the newer version of this specification do not have any such passage, nor any other equivalent text; over the years, all browser makers have standardized on one common behaviour, enabling the highest accessibility for all users, including those who can not use a mouse, and are required to use keyboard navigation.

This includes (but is not limited to):

  • tabbing through links and fields.
  • pressing the enter key to enter a link destination, or to submit your form input.
  • pressing space to (un)select an option on radio-buttons and checklists.
  • 7
    $\begingroup$ You quoted the HTML 2.0 specification, from 1995. You will notice that the revised versions (4.01 being the current one; Google will find it for you) do not have any such passage, nor any other equivalent text... $\endgroup$ Commented Dec 8, 2010 at 1:21
  • 1
    $\begingroup$ I indeed quoted the HTML 2.0 specification, as showing where the practice started, will expand on it to clarify. BTW: I also referenced Internet Explorer 4. $\endgroup$ Commented Dec 8, 2010 at 2:01
  • 14
    $\begingroup$ I don't see any of this beyond the first two paragraphs is relevant. The comment field here is a textarea, not an input field, and to all appearances it looks and acts like a traditional textarea too. Pressing Enter in a textarea is not required to submit the form, and it does not do so by default in most (all?) current web browsers. What StackExchange uses is a customized textarea in which pressing Enter does submit the form. $\endgroup$
    – user856
    Commented Dec 8, 2010 at 3:55
  • 2
    $\begingroup$ Alexanderpas, SE 1.0 (as seen, e.g, in MathOverflow) and SE 2.0 until a few weeks ago did not have this behavior. I doubt the change is a matter of standards compliance, and if it is, Jeff Atwood/SE have not described it as a compliance issue. On MathOverflow.net, which runs on the "StackExchange 1.0" engine and is hosted on SO/SE servers, the Enter-submits-comment behavior is absent, and the OP has no trouble posting multi-sentence paragraphs as comments. In short, the standards appear to be irrelevant. $\endgroup$
    – T..
    Commented Dec 8, 2010 at 4:16
  • $\begingroup$ While the element used is indeed a <textarea>, it could be considered nothing more than a implementation of an <input> element that allows you to see more of the text than only a partial sentence. -- Even more notably, considering the output doesn't support newlines, the behaviour of the input element now matches the output. Also, it notably misses the format bar, and doesn't support full markdown, suggesting it is not a full fledged reply area, but intended only for comments -- I merely tried to show that submitting a form on pressing the enter key is not uncommon behaviour. $\endgroup$ Commented Dec 8, 2010 at 4:42
  • 23
    $\begingroup$ Alexanderpas, if the comment field had only one line, then I think most people would find it natural to submit on enter. But it doesn't. $\endgroup$
    – JDH
    Commented Dec 8, 2010 at 12:04

You must log in to answer this question.

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