11

In the past there was an issue (reported here) where pressing the Enter key to select an IME suggestion would also submit the comment.

The good news is that we believe to have found the proper way to handle this, allowing you to use the Enter key to select your IME suggestion, while also still being able to use Enter to submit the comment if you're not in the middle of composing a word.

We've enabled this on the Japanese Language Meta site to make sure there are no unforeseen issues (every browser handles IME slightly different) and plan to enable it on the main Japanese Language site next, and after that network-wide.

If you use the IME editor regularly, please feel free to test it out (e.g., on the answer below here) and let me know if there's any issues.

I've written a blog post with the technical details of this change.

Thanks!


Update: This is now live on the main site. Please do still let us know if you see any bugs. Thanks!

6
  • 1
    Some technical details on the solution would be very interesting and appreciated.
    – deceze
    Jun 24, 2016 at 18:29
  • 1
    @deceze I wrote a blog post and added a link to it. Jun 24, 2016 at 21:49
  • Cool stuff, thanks!
    – deceze
    Jun 25, 2016 at 6:35
  • Just out of curiosity, did you try simply replacing the keyup handler with a keydown handler? And if you did, what browser / IME combo did it fail on? I'm asking because I'm using that method in SOUP, and if there's some situation where it doesn't work, I'd like to fix it. Oct 5, 2016 at 18:40
  • 1
    @IlmariKaronen I'd have to get into the mindset again, but I think the problem with keydown was either that it wasn't optimal in case people held down the Enter key, or Safari on OS X (which emits an additional keydown event in addition to keyup). Sorry, don't remember the exact reasoning, but I did rule out keydown intentionally. Oct 5, 2016 at 18:43
  • Ah, Safari again. I really need to find some way to test SOUP on it. Thanks for mentioning the hold-down issue, though; I'll add a flag to SOUP so that multiple keydown events won't trigger repeated submissions unless there's a matching keyup event in between. Oct 5, 2016 at 19:01

4 Answers 4

6

Would it be too much to ask for an option to toggle this behavior? I think some people will still find it uncomfortable that you can submit a comment by accident if you press enter one more time than necessary. I'm sure this happened to most of us on other websites before. To me personally it seems counterintuitive to have Enter work this way in a form that can have more than one line. I feel like I should be able to just go to the next line without anything else happening. Yes, formatting in comments is lost anyway, but still.

4
  • I agree that the improved IME handling is very nice, but on other SE sites, I also accidentally submit comments by pressing enter. Then I only have 5 minutes to fix the comment, although I sometimes take longer to write a comment. Even without [Enter] right in the text field, I can still submit the comment from the keyboard by pressing [Tab]→[Space] or [Tab]→[Enter], which I prefer.
    – Earthliŋ Mod
    Jun 23, 2016 at 12:34
  • 1
    The current implementation isn't a per-user setting, so unfortunately, no, we can't keep it as an option at this point. There's an old feature request to restore the don't-submit-on-enter behaviour from back when submitting on enter was first introduced. Six years later, I doubt we'd go back to that overall. A user preference is perhaps not out of the question, but that'd have to be a separate feature request that we'd have to evaluate alongside all others.
    – Adam Lear StaffMod
    Jun 23, 2016 at 15:39
  • 1
    Although I can understand this feature request, I personally think it's okay without the setting. There are plenty of other similar situations where hitting enter submits a message, like in most chat programs or websites for example, so it's something you have to adapt to when typing anyway. And if you do send a message early because you bumped enter, you can just delete it and post again, so it's not the end of the world.
    – user1478
    Jun 23, 2016 at 17:10
  • I found some userscripts for this: stackapps.com/questions/2061/… But they are outdated and don't seem to work anymore...
    – kuchitsu
    Jun 23, 2016 at 17:50
4

I don't think this always works. It seems to work most of the time, but I still end up submitting comments partway through. For example, today I typed this comment:

It looked like こになる was a typo, so I changed it to match the example (こになる).

This comment has two Japanese strings in it. The first one worked fine, but the second one submitted my comment, so I had to edit it to type the rest. This isn't the first time this has happened.

This is on Windows in SeaMonkey, for what it's worth.

2

Please use this answer to test out the comment functionality.

6
  • 1
    テストテストテストテストテストテスト・・・成功~
    – user1478
    Jun 22, 2016 at 22:39
  • 1
    It seems to work :-)
    – user1478
    Jun 22, 2016 at 22:39
  • これもテストです。This is the best thing ever.
    – jmac
    Jun 23, 2016 at 0:50
  • あいうえおあいうえおあいうえお
    – chocolate Mod
    Jul 16, 2016 at 6:05
  • 大丈夫らしいです。最悪のことは行わない。
    – virmaior
    Jul 16, 2016 at 13:24
  • True fact about me: 私は魔法使いだ。Another fact: バナナが好きだ。(EDIT: Seems to work fine in Firefox on Debian Testing with XFCE!)
    – GoBusto
    Oct 18, 2016 at 7:07
0

This is still a problem, and has been for quite some time. I'm finally fed up enough that I'm here on Meta, looking up multiple old posts about this very issue.

Fully-patched corporate install of Windows 10.

Firefox 91.3.0esr.

There appears to be some kind of possible race condition at work -- if I'm going slowly, I can type in Japanese, hit Enter to confirm the IME conversion (or lack thereof), and continue entering my comment. If I'm going quickly, I hit Enter to confirm the IME conversion -- and often wind up submitting the comment prematurely.

This is most frustrating. Even more so when this has been a known issue for years, and a purported fix has been pushed, but the problem remains.

Why is Enter used at all to submit a comment? There is a dedicated UI button right there, Add comment. We don't need this Enter-to-submit functionality at all. It just gets in the way.

You must log in to answer this question.

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