Premature submitting of post on paste after newline

AI-generated summary

A bug has been reported where a post is submitted prematurely when pressing <kbd>ENTER</kbd>, <kbd>ENTER</kbd>, and CTRL+V` in rapid succession. The expected result is for two carriage returns to be entered and the clipboard content to be pasted into the editor. However, the post is submitted without the pasted content.

accalia initially reported the issue, and RaceProUK confirmed that it is tricky to reproduce, but reliably happens when pressing the keys quickly. sam and riking discussed the possibility of a timing issue, and sam was unable to reproduce the issue.

accalia provided a detailed list of tested configurations that exhibit the issue, including various keyboards, hardware, and browsers. Mittineague asked for clarification on the speed required to trigger the bug, and RaceProUK reported that he can reliably reproduce it in about one or two tenths of a second.

tgxworld was also able to reproduce the issue, but noted that it requires pressing the keys at a rate that is unlikely to occur in normal use. He also observed that at a slower pace, the “Post cannot be empty” alert is raised, indicating that there was an attempt to submit the post.

Reproduction steps:

  1. get some data on your clipboard. any old data will do,
  2. start a post in discourse.
  3. In rapid succession press ENTER ENTER CTRL+v to past contents in new paragraph

Expected result: two carriage returns are entered and the clipboard content is pasted into the editor

Actual result: If you were fast enough on that trigger the post will be submitted without the pasted content.

I suspect this is because discourse is handling the CTRLENTER keyboard shortcut incorrectly. Probably by asking “is the CTRL button pressed now?” when processing an enter key, rather than asking the key event directly if any buckybits were set when the key was pressed.

8 Likes

It’s tricky, but fairly reliably reproducible; it’s all down to how quickly you press the keys. The quicker you do it, the more likely you’ll trigger the bug.

@techAPJ I thought we removed all crazy shift-enter handling from wmd.

1 Like

This is ctrl-enter, not shift-enter.

4 Likes

I can not repro this, I tried quite a few times, what browser is this?

I tried too, feels like it’s probably a timing issue and would only show up under load or on certain hardware.

Between me and @accalia, we’ve covered at least half a dozen keyboards across a similar number of machines, and on Chrome, Firefox, and IE.

You have to be really quick to trigger it :wink:

primarily Chrome, i’ve also gotten IE and Firefox to do it.

It’s much easier to reproduce when the site is having one of its slow moments, which is much more common on my home forum that it is here on meta.d. i have been able to reproduce it at steady state as well.

Tested configurations that exhibit the issue:

Membrane and mechanical keyboards (i have machines with both types and both types exhibit the bug.)

Logitech G710+ (mechanical)
Surface Pro 2 Type cover (membrane)
Logitech G510s (membrane)
Logitech K800 (membrane)
laptop keyboards (membrane, no known manufacturer other than “Google” and “HP”)

Hardware (CPU, Ram size and hard drive type) reproducable on:

i7 32GB ram SSD (Windows 8.1)
i3 8GB ram SSD (Windows 8)
Celeron 4GB RAM HDD (Windows 7)
i5 Surface (Windows 8.1)
Chromebook Pixel 2015 (Chrome OS)
Phenom x6 6GB ram HDD/SSD (Windows 7)

also this. unless the site/editor is responding sluggishly you have to be really really fast to trigger it.

“really really fast” is relative. How fast are you talking in terms of actual seconds?

I can do it reliably in about one or two tenths of a second; just did it about 10 times while working that out

yeah, that sounds about right.

as i mentioned it gets easier when the site is under load and acting sluggish

@accalia I’m able to repro this but in order to do so I have to really press the keys are a rate that I feel like no normal user would do. At that speed I’m pretty sure I’m hitting ctrl+v+enter at some point.

However, I did realized that if you go at a somewhat slower pace it raises the Post cannot be empty alert which means that there was an attempt to submit.

:smiley_cat:

2 Likes