Re: [csswg-drafts] paradox issue when "tabindex" is used together with "display: none/contents" or "visibility: hidden"

If we treat elements that have no rendered box “not rendered at all” and thus don’t allow them to react to keyboard events, maybe it would make sense to disallow them to have visible content as well?  Currently, it looks very strange when an element (e.g. a `button` with `display:contents`) visually produces a perfectly visible and interactive (through mouse/touch) control, but this control can’t get focused because implementation-wise it’s “not rendered at all”. Maybe for all interactive control `display:contents` should be treated as `none` then, to avoid this nonsense?

However, I’d prefer it the other way around: if an interactive DOM element has any visible and activatable part of the element subtree and has a `tabindex` property, it should become able to get a “virtual” focus state. This focus state would be invisible by itself, but should affect the styles of element’s descendants (e.g. `button:focus` would do nothing, but `button:focus span` would apply). After all, in the DOM the concept of focus state is the characteristics of the DOM element itself, not its style, and CSS shouldn’ change this aspect of behavior except removing the element from *all* presentations in case of `display:none`.

Anyway, the current really paradoxical situation when we effectively can have visible and interactive “nothing at all” feels like a bug either in spec or in implementation. I’d be happy with either resolution of this “paradox”.

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

Received on Monday, 13 August 2018 21:39:19 UTC