Re: [csswg-drafts] [css-display][css-aam][selectors-4] How elements with `display:contents` get focused?

> It doesn't make much sense to focus something that doesn't have a box.

Respectfully disagree. If the element is interactive, can get activated and responds to events as usual, and its activation behavior can have a visual effect on its contents, I see no reasons why this element can't get focus. Making the element _and all its subtree_ completely unfocusable just because if _is displayed differently_ (not hidden/removed!) is a real usability problem and very unlikely matches the authors' intent to just change the element's presentation, but not changing its semantics nor behavior. Having some "virtual" focus state for the invisible element that can make visual change through the element's descendants seems to be much less problematic than having the element and its whole visible subtree completely not focusable. 

> It might affect whether some methods of focus-traversal can reach it

@tabatkins, could you please show an example? The only way how CSS can prevent the visible and otherwise focusable element from getting focus through click/tap I can quickly imagine is `pointer-events: none` for all its children, but this seems unrelated to `display` to me. I agree with you that "we shouldn't try to get extra-smart with this", and the example with grid container's "grandchildren" displayed as separate grid items seems not more complicated to me than, e.g., absolutely positioned children of the visually hidden focused elements. CSS already can handle multiple boxes changing their style because of one element getting focused, Does `display:contents` really add anything new here?

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

Received on Monday, 30 April 2018 22:45:51 UTC