128

Sometimes on a Windows machine, your focus and attention get stolen by a program presenting a dialog, or you hit the Windows key on your keyboard by accident, causing the Start menu to overlap what you were doing.

The OS allowing this has ingrained a reflex with me: I hit the Esc button to close such annoyances.

This behavior has caused me to curse at the Jira (issue tracking software) website for more than I want to admit: halfway entering an issue details and hitting Esc because something popped up on my screen causes the site to close the entry form popup and you to lose all entered data.

And so does Stack Overflow's comment box.

"But why", you'll ask, "do you press Esc then, if you don't want your data to be lost?". Well, I do if I want, but that's not always the case when it happens.

The issue is, here as well as with Jira, the site responds to the Esc key UP event, without verifying that it previously also received the key DOWN event.

So when I press Esc to close a dialog, or the Start menu, they close - but the key is still pressed. Upon releasing it, it cancels my input on the website. The latter should only happen when the site had the focus when I pressed the key, not only when I release it when the site has focus.

Repro (on Windows, in Chrome):

  1. Post a comment on a Stack Overflow post
  2. Start editing this comment
  3. Press the Windows key
  4. Press the Esc key
  5. See the changes to your comment disappear, as cancel is issued

This occurs in multiple situations, the snippet editor has got the same problem.

22
  • 9
    I had the same problem forever... Good thing you can remap the Windows key on Linux.
    – S.S. Anne
    Jul 15, 2019 at 14:03
  • 2
    With firefox on Ubuntu it looks like there is a bit of a delay in the Esc key after the window key. If I just click it, it doesn't cancel the edit. I have to keep it pressed down for several seconds in order for it to also cancel the comment edit. Jul 15, 2019 at 14:30
  • 4
    In a better world, we would have an event that triggers only after seeing a keydown-and-keyup pair, to make it so that the path of least resistance for hotkeys is to implement them in exactly the way you would like them to be implemented here rather than the way that they in fact have been implemented. Alas, we don't live in that world, and the event that sounds a bit like it ought to do that - keypress - really does something different that's almost identical to keydown.
    – Mark Amery
    Jul 15, 2019 at 18:17
  • 3
    It will be changed. In 6-8 [unit unspecified]. Jul 15, 2019 at 18:38
  • 7
    No repro... or perhaps I misunderstand. If you activate the Start menu (or any other dialog), and then press Esc, the dialog that you're dismissing will "eat" the Esc key press. It won't get passed on to the web browser. The web browser doesn't have focus because the Start menu or other dialog has the focus. Also, it is very standard to respond to the key up event, rather than the key down event, because that allows you the possibility of canceling your action as long as you change your mind before you release the key. Jul 15, 2019 at 19:00
  • 7
    @CodyGray how do you change your mind? Change focus before releasing the key? Jul 15, 2019 at 19:04
  • 3
    Also: ESC does not cancel comment creation, but it does cancel editing of older comment. But is doesn't repro. At least not in FF 68 on win7. I did experience this problem with JIRA though. Apparently it is a FF thing, as other browsers behave differently (they don't send the ESC to the web page). Jul 15, 2019 at 19:06
  • 7
    Here is a similar problem: in a comment type @ followed by a few letters that match several other commenters. Select one by cursor keys and press enter, result: the comment is submitted, even if you only wanted to select a user for replying. Jul 15, 2019 at 19:07
  • 2
    This is probably already posted here: meta.stackexchange.com/q/66646/176236 Jul 15, 2019 at 19:16
  • 2
    Indeed! One needs to actually save the comment before editing it @Cody. Then, I was able to reproduce the esc pressed for the windows key also closing the editing comment dialog. Jul 15, 2019 at 21:30
  • 3
    Posting a comment for testing... EDIT: Can repro. Now I'm annoyed even though this has never affected me.
    – Clonkex
    Jul 15, 2019 at 23:16
  • 3
    @CodyGray Except it doesn't eat the event, at least on Windows 10 with Chrome. I can replicate the OP's issue.
    – Clonkex
    Jul 15, 2019 at 23:17
  • 2
    @DavidBalažic IKR. It took me frickin ages to realise you press tab instead of enter to select it. I'm sure for Linux users this is intuitive, but as a Windows user who never tab-completed anything before I started work at my current job, it never occurred to me that tab might be used to confirm a selection.
    – Clonkex
    Jul 15, 2019 at 23:18
  • 13
    Good find. A GUI equivalent of this would be pressing the mouse button, then moving the pointer over a GUI button, and releasing, and having the button activate.
    – Kaz
    Jul 16, 2019 at 20:31
  • 6
    You can easily reproduce this by hitting edit on this question, then opening something else on top e.g. via the Windows key, and pressing Escape. The edit will then be cancelled. – I agree that this is certainly a confusing behavior. Using the keyup event in general is better than just using the keydown event (ideally, you would check the sequence as OP suggests), so maybe the solution here would be to prompt for discarding unsaved changes when there are changes.
    – poke
    Jul 17, 2019 at 9:32

0

You must log in to answer this question.

Browse other questions tagged .