Why?
I like how keyup is less ambiguous: it avoids the question “what do I do if the user is holding the key down?”
I also like being able to hold the key down to cue up a command and then at the right time, pull my hand away to execute crisply. For video editing mainly.
I’m not saying keyup is the only answer. Just that there isn’t one obvious answer.
Because of the reported bug in this example (which I also encountered quite often):
- user hits ESCAPE
- my window gets key-down/ESCAPE and closes itself
- your window (which happens to be the next in the focus-order) gets key-up/ESCAPE and closes itself
> I also like being able to hold the key down to cue up a command and then at the right time, pull my hand away to execute crisply
Ok, but if your window wants to support this behavior (which is not very common) you have to watch for key-up AND key-down like the bug-report suggests.
Anyway, there's a way to fix this: send a reference to the key-down event when you send the key-up event. Then the receiving window can determine if it cares about it or not. If this is a security hole, send a reference to the window where the key-up event was sent instead.
Not saying key down is better than key up, there are certainly arguments for both.
[0]: https://www.eejournal.com/article/ultimate-guide-to-switch-d...
Should they, in general? If you want to press a key combination, you never press the two keys at exactly the same time. So, if key events were on key-down, you would have to press modifiers before letters to type capital letters, use keyboard shortcuts, etc. I think that would be annoying and slow typists down.
It also rules out using bare modifier key presses as input methods, but that is less of an impact.
Do people who want a capital 'A' ever intentionally type A-Shift instead of Shift-A? I've never heard of it before.