Re: [w3ctag/design-reviews] Review the HTML spec's treatment of focus (#468)

Looking at this in our virtual face to face just now, I have some relatively unstructured thoughts:

If we were adding keyboards as a new usage mode on the web today (as a highly unlikely counterfactual), we would suggest writing an explainer outlining the user needs, the platform constraints, and how the proposed design meets those user needs. It seems like the work done on focus in the HTML spec has only outlined the (no longer proposed, but factual) design, without explaining how it fits together, documenting any regrettable decisions, or any user needs which should be taken into account when designing additions to the system.

In particular, the decision to have `:focus` match on unfocusable shadow hosts when the "actual" focused element is inside a shadow root seems to have made a priority of constituencies trade-off in the dispreferred direction: in order to avoid potentially revealing the existence of a shadow root (theoretical purity, or at best convenience for developers), it shows a focus highlight by default on the shadow host, creating a confusing experience for users.

A much older feature, `tabindex=-1`, also has some regrettable aspects: 
   - It is impossible to tell from the IDL `tabIndex` attribute whether an element is unfocusable, or is only programmatically focusable
   - It causes the element to be focused on click, which is useful in some but not all cases.

I began some work to explore the needs which `tabindex=-1` is attempting to address in https://github.com/WICG/webcomponents/issues/762#issuecomment-692416176, but it would be good to have a full-fledged "focus on the web" explainer which explains in terms of user needs, rather than simply explaining the state of the spec right now.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/468#issuecomment-767224086

Received on Tuesday, 26 January 2021 01:34:34 UTC