logoalt Hacker News

danbructoday at 7:35 AM2 repliesview on HN

For triggering actions (which includes normal typing), you only ever use keydown.

I think you have this wrong, actions generally occur on button release, until that you can move the mouse cursor to a different target, tab to another control, use [ESC] to cancel, and so on. Typing, moving a slider with the cursor keys, and similar things that make use of key repetition while holding down the key are the exception to this.


Replies

chrismorgantoday at 8:46 AM

I am speaking specifically of keyboards. For mice, it’s release. (When I made a similar comment two months ago on Lobsters when this article came up there, I mentioned this, but decided to leave it out this time, thinking the context was clear enough. I think I was wrong.)

show 1 reply
okamiuerutoday at 8:12 AM

Can you give some specific examples? In my experience (which I also verified to make sure), all of the things you mention act on keydown. The exceptions are on multi-key combinations, which follow a special key that is held down while modifiers are entered, where the action is completed by releasing this special key (ALT + TAB [...TAB | SHIFT]) being a common example.

TAB is otherwise immediate, as is ESC, and the examples of typing, as well. So I'm left wondering, how do they have it wrong?