Skip to content

No keydown/keyup for autorepeats; no keypress except for autorepeats #10

@mncharity

Description

@mncharity

InputEvent.Keyboard emits keydown, keyup, and keypress events. This looks like the browser keyboard event api. But it behaves differently.

In browser, a physical depress and release gives a keydown-keypress pair, and then a keyup. A keyboard autorepeat gives just a keydown-keypress pair (it used to give a keyup as well).

EV_KEY is different. Value 1 is physical depress. Value 0 is physical release. Value 2 is autorepeat.

These EV_KEYs are currently emitted as keydown, keyup, and keypress. So you don't get keydown (or keyup) from autorepeats. And you don't get a keypress from any physical key depresses, only from autorepeats.

So while this looks like the browser api, it behaves differently. Which is confusing.

Some possibilities include: (a) document that you don't get keydown for autorepeats, and don't get keypress for physical presses; (b) rename keypress to repeat; (c) rename keyup and keydown to depress and release. (Or to keyrepeat, keydepress, keyrelease?)

Thanks for your work!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions