Re: [csswg-drafts] [css-ui] `interactivity: focusable` (#13040)

@Loirooriol 
> > it’s much easier to expand it to be more granular.
> 
> I think we need to consider plausible future extensions when designing the basic syntax. If we end up allowing to set the index for sequential focusability, then we should maybe add `tab-index: none | <integer>` now and not bother with `interactivity: focusable`.

Oh absolutely we should consider plausible future extensions when designing the basic syntax! I just thought it was unlikely we'd want to enable `tabindex`-like indices in CSS, so by more granular control over order I was envisioning authors being able to declare whether e.g. it's source order, layout order etc. And if these are separate toggles, they _can_ be designed separately.

I actually think the design of `tabindex` in HTML is an antipattern, as it does not reflect author intent well at all. The intent behind `tabindex=0` is to make an element focusable, in source order, but that's not what the API is saying. And `tabindex=-1` is even more cryptic. Only `tabindex` with values > 0 actually reflects author intent, but these cases are pretty rare. So you have authors controlling the thing they actually want (focusability) incidentally, through setting a _different_ variable (tab index). Additionally, indices are a bit of a footgun, as they can easily get out of sync. The ship has sailed for HTML, but we can do better here.

And when it comes to sequential-only or click-only focusable, I could easily envision these being separate keywords. What do you think?

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


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

Received on Tuesday, 4 November 2025 02:19:47 UTC