User Experience Asked on October 31, 2021
When implementing keyboard interactions, platforms provide two kinds of event: "key up" and "key down". For example:
keyup
and keydown
.NSEvent.EventType.keyUp
and NSEvent.EventType.keyUp
.WM_KEYDOWN
and WM_KEYUP
.Therefore, when implementing a keyboard interaction, the developer must choose when the interaction is fired. For example:
The universal provision of both "key up" and "key down" events suggests that the answer is not simple: that, for some situations, "key down" is more appropriate, but for others, "key up" is better.
However, I can find no guidance on this. There are many descriptions of the meaning of "key up" and "key down", but none on how to tastefully choose between them for a given use-case.
In what situations should I prefer a "key up" event? In what situations should I prefer "key down"?
A good rule of thumb is to consider whether the action in question would be desirable to repeat without lifting your finger from the key.
For your examples, if I wanted to see a slide that was much further down the page then it would be better to register the press as soon as the key is pushed down AND to let me hold it down instead of pressing the same down key 20 times to get to where I wanted to be.
The opposite would be true for your video player's pause/resume feature. I wouldn't want to press the spacebar and accidentally hold it for too long so that it would pause & then resume again by the time I let go.
Answered by Benjamin Jex on October 31, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP