lsongdev / lsongdev/input-event

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

Open
#10 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
JavaScript
Stars
65
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with InputEvent.Keyboard and trace how EV_KEY values 0, 1, and 2 become keyboard events. Review the browser behavior described in the issue and determine which event naming or documentation approach is appropriate. Done means the event semantics are decided and implemented or documented consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, linux
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.