Re: [w3c/uievents] Dispatch a click event when keyup or keydown? (#174)

dosisod left a comment (w3c/uievents#174)

Providing some extra context from [an issue](https://github.com/LadybirdBrowser/ladybird/pull/6715) I posted on the LadyBird project.

From https://w3c.github.io/uievents/#event-type-keydown (emphasis added):

> The default action of the `keydown` event depends upon the key:
> 
> * If the key is the `Enter` or ` ` (Space) key and the current focus is on a state-changing element, ***the default action MUST be to dispatch a click event, and a DOMActivate event*** if that event type is supported by the user agent.

The [keyup](https://w3c.github.io/uievents/#keyup) event spec makes no such mention of how the Enter/space key should be handled.

You can use [this site](https://adrianroselli.com/2022/04/brief-note-on-buttons-enter-and-space.html) to test the Enter/Space handling logic on different browsers. In addition, the behavior is different when pressing and holding Enter or Space, which also does not seem to be documented.

I believe Ladybird should follow the lead of Firefox and Chromium when it comes to key repeats to avoid breaking accessibility norms. With that being said, as it pertains to the `keydown` spec, either:

* The spec is wrong/outdated, and browsers have decided to follow this `keydown`/`keyup` repeat logic
* The spec is correct, and browsers have chosen to do something that is wrong
* There is a different spec which covers and explains this accessibility behavior, and that documentation should be referenced in the `keyup`/`keydown` specs.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/174#issuecomment-3635005072
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/uievents/issues/174/3635005072@github.com>

Received on Wednesday, 10 December 2025 01:47:58 UTC