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):
- Post a comment on a Stack Overflow post
- Start editing this comment
- Press the Windows key
- Press the Esc key
- See the changes to your comment disappear, as
cancel
is issued
This occurs in multiple situations, the snippet editor has got the same problem.
keypress
- really does something different that's almost identical tokeydown
.