Re: [csswg-drafts] [selectors] Should `:active` match spacebar down? (#7332)

> “if the element is [focusable](https://html.spec.whatwg.org/multipage/interaction.html#focusable)” — suggests to me that it _could_ apply to any element activated.

Turns out, yes, the HTML spec there says that

> _[Focusable] Elements that meet all the following criteria:_
> - _the element's `tabindex` value is non-null, or the element is determined by the user agent to be focusable_ […];

And there is even a direct example under [`:active`](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-active): 

> _For example, if the user is using a keyboard to push a `button` element by pressing the space bar, the element would match this _pseudo-class_ in between the time that the element received the `keydown` event and the time the element received the `keyup` event._

From these two rules it really seems to me that pressing a space bar on a focused `<what-ever tabindex="0">` should work (provided it is light-DOM without focus delegation and non-disabled).

--- 

Overlooked that in a [Roman's comment](https://bugzilla.mozilla.org/show_bug.cgi?id=68851#c17), what led BZ to (IIUC) ask about which concrete keys should be involved in this process: whatwg/html/issues/2725

-- 
GitHub Notification of comment by myfonj
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7332#issuecomment-2849488121 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 4 May 2025 23:08:17 UTC