Re: [csswg-drafts] [css-display-4] Define how reading-order / reading-order-items interact with focusable display: contents elements. (#9230)

The CSS Working Group just discussed `[css-display-4] Define how reading-order / reading-order-items interact with focusable display: contents elements.`, and agreed to the following:

* `RESOLVED: reading-flow does not affect whether an element is focusable`

<details><summary>The full IRC log of that discussion</summary>
&lt;bramus> rachelandrew: issue around how our new reading-flow property interacts with focusable display: contents elements<br>
&lt;bramus> … got input from mason and di in the issue<br>
&lt;bramus> … question is from di at the bottom<br>
&lt;bramus> … should a display: contents with ?? be considered reading order items?<br>
&lt;bramus> … di also suggested that display: contents elements really arent focusable<br>
&lt;bramus> … can make it so that display: contents children are not reading order focusable<br>
&lt;bramus> … would love to hear thoughts<br>
&lt;bramus> dbaron: there are a bunch of complicated issues here<br>
&lt;bramus> … because on the one hand weve gotten feedback from a11y folks tha focusability and ?? should match each other<br>
&lt;bramus> … you shouldnt be able to do sth that takes an item out of fcous order but not the a11y tree<br>
&lt;bramus> … things like that<br>
&lt;astearns> s/??/reading order/<br>
&lt;bramus> … when you are saying that reading order should depend on box order it doesnt make sense to go through a thing that doenst generate boxes<br>
&lt;iank_> q+<br>
&lt;bramus> … easy way out is to say that if you are using one of the readingflow values that depend on box order that elements with display: contents are not part of that order, ie not focusable<br>
&lt;bramus> … not ideal from a11y POV i think<br>
&lt;bramus> … I have an almost finished project to make elements with display: contents focusable but hasnt happened yet<br>
&lt;bramus> … pulling that back would be a partial reverse of the change to make display: contents focusable<br>
&lt;bramus> … alt is to come up with some rule that says where it goes in the order<br>
&lt;bramus> … not hard to make that rule, might be hard to impl<br>
&lt;bramus> … doing the right thing for a11y vs doing a thing that is implementable/describable<br>
&lt;bramus> astearns: is your change that the element with display: contents is focusable or that its children are focusable?<br>
&lt;bramus> dbaron: the element<br>
&lt;astearns> ack iank_<br>
&lt;iank_> ```<br>
&lt;iank_> &lt;div style="display: contents;"><br>
&lt;iank_>   &lt;div>1&lt;/div><br>
&lt;iank_>   &lt;div style="order: 5;">2&lt;/div><br>
&lt;iank_> &lt;/div><br>
&lt;iank_> &lt;div>3&lt;/div><br>
&lt;iank_> ```<br>
&lt;bramus> iank_: there’s a case that i pasted here in irc<br>
&lt;bramus> … with the order prop and grid/flex reordering things you can pull items bc display: contents doestn have a box you can pull out of the display: contents and the iteration order doesnt become clear<br>
&lt;bramus> … in this case here, the order would be 1 3 2<br>
&lt;bramus> but display: contents is wrapping 1 and 2<br>
&lt;bramus> … so maybe we shouldnt consider display: contents<br>
&lt;bramus> … there might be other solutions<br>
&lt;astearns> ack fantasai<br>
&lt;bramus> fantasai: def an awkward situation. if author asks for it to be focusable then we should try to<br>
&lt;bramus> … would mean to figure out a place to put it in the order<br>
&lt;bramus> … before any other items it contains would make sense<br>
&lt;bramus> … even if they are split across multiple places<br>
&lt;florian> q+<br>
&lt;bramus> dbaron: to poke some holes into that<br>
&lt;bramus> … 2 edge cases<br>
&lt;bramus> … 1 of them is the item has no children at all and therefore ther eis no box at all<br>
&lt;bramus> … other thing is that child is also display: contents<br>
&lt;bramus> … no children at all is messy<br>
&lt;bramus> … other thing leads to recursion<br>
&lt;bramus> fantasai: no contents: if we were reordering all the items and ?? between prev and next siblings<br>
&lt;bramus> … if we reorder those then we could give up and shove it up the end<br>
&lt;bramus> … not sure what authors would expect<br>
&lt;bramus> … between the two makes sens<br>
&lt;astearns> ack florian<br>
&lt;bramus> … we might fix either attach to the prev or attach to the next as a sort of option so that at least when they are together it lands in the middle<br>
&lt;bkardell_> s/sens/sense<br>
&lt;bramus> florian: can i suggest to go the opposite route and say that display: contents does not apply to focusable elements?<br>
&lt;bramus> fantasai: interesting<br>
&lt;bramus> TabAtkins: that would break specs though … the TOC in it for example<br>
&lt;bramus> florian: but does it need to be focusable?<br>
&lt;bramus> TabAtkins: you can tab into the children spans<br>
&lt;bramus> fantasai: ????<br>
&lt;bramus> TabAtkins: if you prevent focusable elements from becoming display: contents then it would break ?????<br>
&lt;bramus> florian: but the a is<br>
&lt;bramus> TabAtkins: this is a focusable &lt;a><br>
&lt;bkardell_> q+<br>
&lt;bramus> … the fact that its used in a TOC for spec suggests that ???<br>
&lt;bramus> kbabbitt: is it actually focusable?<br>
&lt;astearns> s/kbabbitt/bkardell_/<br>
&lt;bramus> TabAtkins: it does not. what lforian said is to prevent focusable elements from becoming display: contents<br>
&lt;bramus> bkardell_: a is focusable if it has an href<br>
&lt;bramus> TabAtkins: it does, wouldnt use a otherwise<br>
&lt;bramus> florian: you mean that every entry in it is an a?<br>
&lt;bramus> TabAtkins: yes, but i am positioning in the grid the contents of it<br>
&lt;astearns> ack bkardell_<br>
&lt;bramus> florian: to keep pushing … tab’s case is an important point but its a subset<br>
&lt;bramus> … if we had ::contents the bit that needs to be focusable is that<br>
&lt;bramus> … you dont have element with a bunch of children that might or not be focusable<br>
&lt;bramus> … you want to layout the ::before and ::after<br>
&lt;bramus> … the part that is focusable is everything except those<br>
&lt;bramus> … seems a subcase of I have a focusable element with stuff underneath<br>
&lt;bramus> … seems that this case is less ? than the whole problem space<br>
&lt;bramus> TabAtkins: was using this as an example to counter your request<br>
&lt;bramus> florian: yes, but I think its a subcase<br>
&lt;emilio> I think this is a huge tangent, I don't think we should make display: contents not work like that<br>
&lt;bramus> TabAtkins: correct solution here is to use subgrid here. there are other solutions here<br>
&lt;emilio> We either do what we do now (display: contents makes stuff not focusable), or make display: contents focusable and deal with it<br>
&lt;bramus> astearns: given that we cant change other behaviors, what should we do here?<br>
&lt;bramus> florian: for this case: kind of has an obv answer.<br>
&lt;astearns> s/that/the likelihood that/<br>
&lt;bramus> … it is effectively everything except before and after that remains focusable<br>
&lt;bkardell_> q+ for miriam<br>
&lt;bkardell_> q+  miriam<br>
&lt;bkardell_> q-<br>
&lt;emilio> q+<br>
&lt;bramus> … which I think is different from situation where you have a bunch of child elements and then you cant place those<br>
&lt;bramus> rachelandrew: I feel like if in the situation where the author has asked to make it focusable then we have to honor that<br>
&lt;bramus> … the default propably is that its not focusable<br>
&lt;bramus> … its a visual hting we are doing with reading-flow<br>
&lt;bramus> … general use case gonna be that ???<br>
&lt;bramus> … if people asked to make the box focusable then we need to consider some of elika’s suggestions<br>
&lt;bramus> florian: or go back to my other suggestion. if you set tabindex on display: contents then you cant<br>
&lt;lwarlow> q+<br>
&lt;bramus> s/if you set tabindex on display: contents then you cant/if you set tabindex on then display: contents does not apply<br>
&lt;florian> q+<br>
&lt;astearns> ack miriam<br>
&lt;bramus> miriam: currently a11y experts have said us not to use display: contents bc browser bugs and regressions<br>
&lt;bramus> … not reliable to use display: contents on anything that needs semantics<br>
&lt;astearns> ack emilio<br>
&lt;bramus> … sara soueidan recently mentioned it again at css day<br>
&lt;bramus> emilio: we should stop discussion making display: contents not work on focusable things<br>
&lt;bramus> … i think it would be super confusing to do<br>
&lt;bramus> … can decied that display: contents elems are not focusable<br>
&lt;bramus> … not a big deal i think, but opinions<br>
&lt;astearns> q+<br>
&lt;bramus> … or can deal with reading order ??<br>
&lt;florian> q-<br>
&lt;bramus> … cant overfocus on one case specifically (e.g. tabs example)<br>
&lt;astearns> ack dbaron<br>
&lt;bramus> dbaron: rachel suggested to (IUC) sort of make setting tabindex be a stronger indication of focusability that would override some other things that make it non focusable<br>
&lt;bramus> … this scares me bc the rules are already very complicated<br>
&lt;bramus> … an overriding layer seems like a huge mess<br>
&lt;astearns> ack lwarlow<br>
&lt;bramus> lwarlow: i dont fully understand the problem<br>
&lt;bramus> … display: contents is used a lot with shadow dom<br>
&lt;bramus> … largely due to other issues with shadow root<br>
&lt;bramus> … suggestion of making the children of display: contents dont work with reading order feels strange<br>
&lt;bramus> … my intuition would be to ignore display: contents and treat it as if those children were where that display: contents element is<br>
&lt;bramus> … ??? even if source order doesnt match that<br>
&lt;bramus> … so making display: contents focusable here seems like wrong thing<br>
&lt;bramus> emilio: I thought idea was to make display: contents element not focusable / reachable by tab<br>
&lt;bramus> … but maybe I misunderstood<br>
&lt;bramus> dbaron: thats what i was thinking at least<br>
&lt;bramus> … agreeing with emilio here<br>
&lt;florian> q?<br>
&lt;bramus> emilio: so basically it would work but we wouldnt be able to ??? an element that would be ??? if you are reading visual order<br>
&lt;emilio> s/???/reach by tab/<br>
&lt;bramus> rachelandrew: i think that was the orig thinking. to not focus an element if you were doing that<br>
&lt;emilio> s/???/display: contents/<br>
&lt;florian> q?<br>
&lt;florian> q+<br>
&lt;bramus> … its whether that causes a problem here if we have unfocusable display: contents elems<br>
&lt;bramus> astearns: i think im confused<br>
&lt;bramus> … suggestion to do a copout but to have a principle that what we do with reading=flow and display: contents should be same as what we do with focusabilyt and display: contents<br>
&lt;astearns> ack astearns<br>
&lt;bramus> … not sure if that is actually desirable given the last few comments<br>
&lt;astearns> ack fantasai<br>
&lt;florian> q-<br>
&lt;bramus> fantasai: would be unexpected if lets say you have flexbox and use display: contents on some child and on some other item you set order: -1 and then you set reading-flow<br>
&lt;bramus> … even if you didnt do any reordering, the display: contents elem in the middle would disappear from the tab order<br>
&lt;bramus> … would be unexpected<br>
&lt;bramus> … and probably not notice dby many, so probably shouldnt do<br>
&lt;emilio> q+<br>
&lt;florian> q+<br>
&lt;bramus> … elems should remain focusable<br>
&lt;bramus> … best to put it before the first item that uses it<br>
&lt;bramus> … best place if it had no children attach to element before or after or both if ????<br>
&lt;bramus> … if youve to a working layout without reading order then it shouldnt break<br>
&lt;astearns> ack emilio<br>
&lt;bramus> emilio: slight counterpiont: if you make display: contents elem focusable. any visual feedback … you would already need to be careful with its styles, e.g. a link with an outline … youd have to style descendant or something<br>
&lt;bramus> … less concerned about authors accidentally removing it from tab order<br>
&lt;lwarlow> q+<br>
&lt;bramus> … its unfortunate but its a can of worms<br>
&lt;miriam> browser issues documented: https://adrianroselli.com/2022/07/its-mid-2022-and-browsers-mostly-safari-still-break-accessibility-via-display-properties.html<br>
&lt;bramus> … personal preference to make display: contents not focusable<br>
&lt;bramus> … but i get it<br>
&lt;astearns> ack florian<br>
&lt;miriam> and current state noted on caniuse: https://caniuse.com/css-display-contents<br>
&lt;bramus> florian: maybe thats just me, but i think we are talking in the abstract and maybe therefore cant find the right thing to do. need usecases and think on the basis of what people are actually doing with display: contents<br>
&lt;miriam> seems buttons are the primary remaining issue in most browsers<br>
&lt;bramus> … we are going in circles i thikn<br>
&lt;bramus> fantasai: if its focusabl ein the middle of the list wihtout reading order items and then applying it makes it no longer focusable … seems wrong<br>
&lt;bramus> florian: i agree in principle but we should know what people are doing with it<br>
&lt;bramus> … we know of tabs cases here but what everyone is doing here<br>
&lt;bramus> fantasai: ???<br>
&lt;emilio> q++<br>
&lt;emilio> q- +<br>
&lt;emilio> q+<br>
&lt;bramus> florian: agree. just confused by combinatin of statement by a11y people saying dont do it and us doing ???<br>
&lt;bramus> fantasai: (missed)<br>
&lt;fantasai> s/???/if I have a flexbox and it contains an item with 'display: contents' that's focusable and it is reachable now, and all I do is flip reading-flow on the flexbox, that *should not change the focusability of its children*/<br>
&lt;bramus> astearns: this is getting heated … emilio wanted to reply?<br>
&lt;astearns> ack emilio<br>
&lt;bramus> emilio: swithcing reading order wihtout display: contents can change to top order with shadow dom in various ways<br>
&lt;astearns> s/heated/more heated than it needs to be/<br>
&lt;bramus> … maybe that expectation is already broken? bc of how shadow dom tab scoping order works<br>
&lt;bramus> fantasai: there is a difference in changing the order making it not tabbable<br>
&lt;bramus> emilio: thats fair<br>
&lt;bramus> lwarlow: 100% agree with elika<br>
&lt;bramus> … cant change unrelated element and then suddenly make it no longer focusable<br>
&lt;florian> s/us doing ???/us figuring out what happens if you do it, without considering why people are doing it<br>
&lt;bramus> … changing tab order is what you expect<br>
&lt;bramus> … not focusable is not<br>
&lt;emilio> q-<br>
&lt;bramus> … not durable<br>
&lt;astearns> ackl lwarlow<br>
&lt;emilio> ack lwarlow<br>
&lt;bramus> … important to understand use cases, but tangent to this problem<br>
&lt;astearns> s/durable/doable/<br>
&lt;bramus> … you may not even know if you have a display: contents child<br>
&lt;bramus> … it should still be focusable<br>
&lt;bramus> … if you are using a web component from somewhere else, you have no control over it<br>
&lt;bramus> … i dont think we can make it suddenly not work<br>
&lt;bramus> … also "don’t use display: contents"<br>
&lt;TabAtkins> in retrospect it's kinda a fundamentally bad idea, tbf<br>
&lt;bramus> … reason for that is that its historically broken in browsers, not that its a bad idea<br>
&lt;florian> q+<br>
&lt;chrishtr> q+<br>
&lt;bramus> … cant disregard whole usecase because historical issues<br>
&lt;miriam> [nods]<br>
&lt;bramus> astearns: can maybe resolve on that reading flow should have no effect on focusability<br>
&lt;astearns> ack dbaron<br>
&lt;florian> q- later<br>
&lt;bramus> dbaron: regarding fantasai’s example: example 1st and 2nd time was slightly different<br>
&lt;bramus> …the 1st time it was setting order, 2nd time reading-flow<br>
&lt;fantasai> 1st example: flexbox containing e.g. 5 items, with 3rd item `display: contents` element, and last item with `order: -1`<br>
&lt;bramus> … what i was suggesting for if we need a condition for when these things might not be focusable, it would be only for use of reading-flow not order, rather than both<br>
&lt;fantasai> 2nd example: flexbox containing an item with `display: contents` and no use of reordering<br>
&lt;bramus> … there is a distinction between both<br>
&lt;florian> qq+<br>
&lt;bramus> … other thing: what luke already said: i think what we are trying to do here is fix the reasons why a11y folks are saying not to use this stuff<br>
&lt;florian> q-<br>
&lt;bramus> … bc people have use cases. only thing is that a11y folks say its currently broken<br>
&lt;bramus> chrishtr: concrete example from mason (2nd comment int he issue) display: contents elme with tabindex with 2 children<br>
&lt;bramus> … difficulty stems from conflict of values of order and tabindex of parent<br>
&lt;bramus> … not sure why this problem is specific to display: contents<br>
&lt;bramus> … wouldnt a parent with tabindex and order children cause problems even if parent was not display: contents<br>
&lt;bramus> lwarlow: order property woulnd taffect thme<br>
&lt;bramus> chrishtr: only ????<br>
&lt;bramus> lwarlow: thats my understanding<br>
&lt;bramus> dbaron: issue with masons thing is that ?? is reordering its grandchildren because it has display: contents<br>
&lt;bramus> chrishtr: could we  resolve by causing display: contents to act like some kind of order affecting stacking content group (?)<br>
&lt;kizu> q+<br>
&lt;bramus> … could have a display: contents cause a flex item children to all have continous ordering<br>
&lt;astearns> ack chrishtr<br>
&lt;bramus> dbaron: thats probably not a compat problem I guess<br>
&lt;bramus> iank_: doesnt work for grid bc you can place grid items in any row/col<br>
&lt;dbaron> s/not a/a/<br>
&lt;bramus> chrishtr: do you have an exmaple?<br>
&lt;bramus> TabAtkins: notion of keeping them together as a group. in grid each item is individually placed<br>
&lt;bramus> chrishtr: but you can specify order on grid children, right?<br>
&lt;florian> q+<br>
&lt;bkardell_> s/exmaple/example<br>
&lt;bramus> … suggestion to reinterpret order for children of display: contents elements<br>
&lt;bramus> TabAtkins: nesting their order?<br>
&lt;bramus> chrishtr: yes<br>
&lt;bramus> iank_: would be surprising to authors<br>
&lt;bramus> … bc it wouldnt read in that order anymore<br>
&lt;bramus> astearns: i think we are going to have to wrap up<br>
&lt;astearns> ack florian<br>
&lt;bramus> florian: unless i misunderstood, chris has an interesting thing to focusalbe children of a display: contents elem<br>
&lt;bramus> … IUC thats not what your proposal adddresses<br>
&lt;bramus> … can be intersting, but doesnt solve this problem<br>
&lt;bramus> chrishtr: maybe I misunderstood mason’s example<br>
&lt;bramus> dbaron: I think its not that you have to go in and out, but its not clear where to put the parent in the tab order<br>
&lt;bramus> kizu: from a11y POV this case is violation. you cant have interactive elements nested inside other interactive ones<br>
&lt;bramus> … for when display: contents we should use focsable<br>
&lt;bramus> … maybe we can split focusable area into multiple ones?<br>
&lt;bramus> … if we have button with some interactiveelement inside, we split all the text parts around it into two ??? and then split<br>
&lt;florian> +1 to kizu<br>
&lt;bramus> … this way whatever we do, order would be logical from author POV<br>
&lt;bramus> … focus button, then text, then ???, then 2nd textnode<br>
&lt;astearns> ack kizu<br>
&lt;bramus> … when we consider all consecutive non interactive parts of display: contents as separate focusable areas we can mix with other interactive elements inside<br>
&lt;bramus> … with this solution wec an solve reading order and bigger issue with nested elements<br>
&lt;astearns> ack dbaron<br>
&lt;bramus> dbaron: my concern with that is that focus state is something that is in the DOM<br>
&lt;bramus> … given that focus is a thing associated with an element, its not clear how you make clear that an item appears 2 times int he tabbing order<br>
&lt;bramus> kizu: i think it would work, same as when you click<br>
&lt;bramus> … ???<br>
&lt;florian> q+<br>
&lt;astearns> zakim, close queue<br>
&lt;Zakim> ok, astearns, the speaker queue is closed<br>
&lt;bramus> … authors dont want to know which part you clicked, only that you clicked the element<br>
&lt;bramus> … order of things … focus on the text, then inner, then parent again<br>
&lt;bramus> … could be confusing for authors but preserves a11y<br>
&lt;dbaron> (I disagree, but I should probably let other people talk.)<br>
&lt;astearns> ack chrishtr<br>
&lt;kizu> I will comment in the issue<br>
&lt;bramus> chrishtr: 2 points: would be super helpful if you could write that down explicitly<br>
&lt;bramus> … and then walking through that in detail would be helpful when we come back to this issues<br>
&lt;bramus> … if this is an anti-pattern then we need a good thing for readers to get to the content eventually<br>
&lt;astearns> ack florian<br>
&lt;bramus> … would love to learn more too about why this is an anti-pattern<br>
&lt;bramus> florian: I like kizu’s suggestion<br>
&lt;bramus> … html spec distinguishes focusable element vs focusable area<br>
&lt;bkardell_> q+<br>
&lt;bramus> … the area can be an elemenent or part of an element<br>
&lt;bramus> … so there is already a notion of this in the HTML spec<br>
&lt;bramus> … should explore kizu’s idea<br>
&lt;bramus> bkardell_: want to warn about confalting interactive element with tabindex<br>
&lt;bramus> … should be careful about that<br>
&lt;bramus> astearns: so we should take it back to the issue?<br>
&lt;bramus> rachelandrew: so we all believe that ?? should be focusable?<br>
&lt;bramus> florian: maybe can resolve on regardless of what and how that reading-flow doesnt change that<br>
&lt;bramus> fantasai: thats what rachel is syaing<br>
&lt;fantasai> s/??/items with `display: contents`<br>
&lt;bkardell_> s/… should be careful about that/They aren't really interchangeable. There are complex interactive elements that do nest tab indexes and that's expected.<br>
&lt;bramus> florian: i think we are saying the same thing, but wanted to express that in a way we dont block romans thing<br>
&lt;bramus> bkardell_: can agree … and can also agree to make display: contents eventually focusable<br>
&lt;bramus> astearns: but thats a separate issue<br>
&lt;bramus> … shadow dom and at least a bunch of other things<br>
&lt;emilio> reading flow should not make elements not reachable in the tab order or something?<br>
&lt;bramus> … eg fragmentation, formatting context, …<br>
&lt;bramus> … would like to scope this to only effect of reading-flow<br>
&lt;bramus> chrishtr: did we prev resolve to make display: contents focusable?<br>
&lt;fantasai> PROPOSED: reading-flow does not affect whether an element with `display: contents` is focusable<br>
&lt;bramus> dbaron: dont remember off the top of my head<br>
&lt;lwarlow> +1<br>
&lt;bramus> astearns: we have proposed resolution<br>
&lt;dbaron> dbaron: ... which discussions were in CSS and which were in WHATWG<br>
&lt;bramus> … maybe that is too specific?<br>
&lt;bramus> … maybe “reading-flow does not affect whether an element is focusable”<br>
&lt;fantasai> PROPOSED: reading-flow does not affect whether an element is focusable<br>
&lt;bramus> florian: both work for me<br>
&lt;lwarlow> +1<br>
&lt;fantasai> +1<br>
&lt;bramus> astearns: objections?<br>
&lt;bramus> RESOLVED: reading-flow does not affect whether an element is focusable<br>
&lt;bramus> astearns: please keep commenting on the issue and put real world examples<br>
&lt;bramus> … will come back to this later<br>
&lt;fantasai> scribenick: fantasai<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9230#issuecomment-2165098385 using your GitHub account


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

Received on Thursday, 13 June 2024 09:19:40 UTC