-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for CSS reading-flow #10613
base: main
Are you sure you want to change the base?
Conversation
By the way, in the OP you have "At least two implementers are interested (and none opposed):" checked, but neither of the two linked standards positions have been resolved yet, so I'd uncheck that unless you you have other cross-browser support to point to. |
Thanks for the first pass!
Thanks for the call out. There has been conversation in meetings and implementers from non-chromium browsers are interested and none opposed. But I will wait for their comments on the official position issues before checking the checkbox. |
Status update: I have addressed all the formatting comments. @domfarolino and other reviewers proposed more suggestions and changes at TPAC 2024. I will go back to working on the proposal before making more changes to this spec PR. |
8a1ee6d
to
93ec208
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for writing this! It looks quite clear. One thing I'm missing from the surrounding discussion we had are the examples. I thought those would be added to the specification in some fashion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTML spec shouldn't be written in a way that depends on specific CSS properties, because these can change--we shouldn't need to change the HTML spec to change how CSS calculates the reading order.
HTML should use a generic concept of a "rendering-defined sibling reading order" or something like that, which both specs can refer to. Then CSS can say how that order is calculated, and HTML can say how it interacts with HTML features and algorithms.
There have been multiple different proposals for how CSS calculates reading order, only some of which depend on values of reading-flow
. For example, we have discussed a property on the items (reading-order
), a property on the container (reading-flow
), a variety of different types of values for each, and the possibility of even changing behavior for effects like dense
packing to perform layout-based reordering by default (no specific property). All of this is out of scope for the HTML spec, and shouldn't be locked down into it as if it were the defining spec for these features.
Thanks for the feedback. I will update this spec to remove any specific CSS properties and instead refer to CSS Display 4 for rendering-defined sibling reading order and reading flow container. Next, I will refactor this PR accordingly to have only the reading flow order in the context of a focus navigation scope and illustrate the steps with a detailed example. |
I have updated the PR with a thorough example for the reading flow order algorithm without referring directly to any 'reading-flow' property. Would appreciate your review, thanks. Note: I am working with @rachelandrew to update the definitions in css-display-4. |
The CSS Working Group just discussed The full IRC log of that discussion<keithamus> Di: since tpac we've had good conversations on how to handle cases for reading flow<keithamus> Di: we defined what a scope owner is and so forth. Today is to clarify what we leave to css and what we leave to html <keithamus> Di: most of the traversal logic is in html spec. We're fetching the css display spec to determine container and reading flow sibling for elements <keithamus> ack keithamus <astearns> ack fantasai <keithamus> fantasai: why are there so many dependencies on the css spec? AFAICT the only thing the html spec needs is css definition of order? <keithamus> fantasai: what are the behavior differences on something having the reading-flow property? <keithamus> Di: we don't depend that much on css. We are describing a list of nodes already ordered by reading flow and establishing that on the html side <keithamus> masonf: the dependencies are as expected: what is a reading flow container and what order <keithamus> fantasai: what is a reading flow container? <keithamus> Di: flex or grid container and the order of grid rows and columns and such. We need it so we can switch into a different mode <keithamus> fantasai: we should have as a principle if the reading flow does not change the ordering of the container it should be a no-op. If I set reading-flow: flex-flow and the order of my layout matches source ordering it shouldn't impact html algorithms <keithamus> fantasai: you're saying if I set it and it matches the order will be different? <keithamus> annevk: there is an impact on tab index if its set <keithamus> annevk: tabindex is scoped to the container <keithamus> fantasai: if we're introducing a feature for scoping tabindex we should do it where we dont have to flip on one of these other things; it shouldn't be a side effect of grid layout following visual order <keithamus> annevk: this is the only case where we need it; for now they're coupled. maybe in the future they can be uncoupled <keithamus> masonf: the reading-flow property adds new behaviors for tabindex, it's a focus scope, it scopes tabindex, it turns on a set of behaviors by using it <keithamus> fantasai: that behavior should be available without having to change the order; you shouldnt have to change your ordering to get that <keithamus> astearns: that's separate from the issue of how to spec? <keithamus> fantasai: then you have two contexts; one is the creation of tabindex scoping the other is css providing a different order for children than you had original <keithamus> annevk: we dont want one without the other <masonf> q+ <keithamus> annevk: once you have the container - the container is telling us css is doing something to the children <keithamus> annevk: its not clear we want to impact tabindex independently from that <astearns> ack masonf <keithamus> masonf: the tabindex part of this is to avoid breaking the feature. tabindex messes up the focus order in specific ways. Confusing situations bouncing between containers <keithamus> masonf: I dont think this is a tabindex feature - it's fixing broken behavior when you're using this feature <keithamus> fantasai: I feel uncomfortable with turning it on and it not being a no-op when its the default order. it shouldn't impose additional behavior, ideally. <masonf> You can already scope tabindex with shadow dom or iframes or... <keithamus> fantasai: secondly if there is scoping of tabindex I think that might be what people want for other purposes but they shouldn't need to change how their items are ordered in order to get that <keithamus> fantasai: if that seems like something people want to do <keithamus> annevk: generally tabindex is a misfeature, Im not sure how much we want to build upon it. We just need to handle it <keithamus> masonf: iframes, shadowdom, slots, all create tabindex focus scopes <keithamus> fantasai: they require changing your html. It's not just "add this extra attribute or container", the document needs restructuring <keithamus> masonf: that's true but then we fall back to annevk's argument of this is a misfeature <masonf> q+ <keithamus> fantasai: I don't think we should introduce a new mode for tabindex solely as a side effect that does something different <lwarlow> q+ <fantasai> s/that/of something that/ <keithamus> astearns: it sounds to me like this is a necessary side effect for the reading order property, so we have to include it <keithamus> astearns: but I'm not sure if it's worth making a separable feature if the use cases aren't justified <astearns> ack masonf <keithamus> masonf: tabindex is a misfeature and a footgun. The reasons we had to make this a special feature is because otherwise it becomes worse than the existing footgun. This is to protect users from really bad things, not a "oh look here's a cool new feature". <rachelandrew> +1 to masonf, if we make it a feature it's like we're suggesting people use it. <keithamus> fantasai: the tabindex is whatever numbers they are inside that element, you never jump in and out of the element? It doesn't interleave? <keithamus> masonf: correct, it keeps you jumping between reading flow items <keithamus> masonf: the UA has put them nicely for you in the correct order, but tabindex might mess up the ordering in very confusing ways, including perhaps loops <astearns> ack lwarlow <keithamus> lwarlow: I don't fully know the ins-and-outs but my understanding is that it's not doing something completely different to changing tabindex? It changes the way tab works - tabindex is defining the ordering within the source; reading-flow is saying to ignore the source and do something else. So it doesn't seem completely unrelated. <keithamus> lwarlow: it seems logical that my source code is now being ignored for a visual order. That's just my perception <keithamus> fantasai: I understand if reading flow says you're going to ignore the tabindex because css is overriding it. I also understand if we say that reading-order is a new source order, and tabindex operates on top. But scoping tabindex in this new way when css defines a new reading order feels off <keithamus> masonf: how would you avoid the footguns then? <keithamus> fantasai: can you give me a concrete example? <keithamus> masonf: a local loop; tabindex jumps you to another item and you jump back to the one before. <keithamus> fantasai: that's an abstract example <keithamus> q+ <keithamus> annevk: the other thing was - in order to land this in the html spec the css side needs to be ready. Is it in a WD, is it in review? Is it going to be renamed? What's the stability <keithamus> fantasai: we don't have a FWPD of the display module. Issues raised against it are not insignificant. I dont know if that'll result in changes to syntax or two different values or something like that. <keithamus> fantasai: I wouldn't qualify it as solid/ready to ship <keithamus> fantasai: how much will it change? I don't know <keithamus> astearns: we should prioritise FPWD <keithamus> fantasai: interaction with html though - we can basically say there's going to be one or more properties in CSS that can change the desired reading order of a set of children of a box. <keithamus> annevk: presumably of a node? Like an element? <keithamus> fantasai: an element <keithamus> fantasai: and css will define an algorithm going from source order to reading order <keithamus> annevk: html has that with the container thing... anyway I think I agree. A good next step for this feature to focus on <keithamus> keithamus: why not ignore tabindex in reading-flow? <keithamus> annevk: we ignore it on the container but it makes sense for it to be preserved in children <keithamus> astearns: it sounds like we need more discussions on how scoping tabindex works, and not doing it causes problems. We'll go back to CSSWG to work on the draft. <keithamus> annevk: when you reference the issue - the html PR is not the issue it should go |
Adding "do not merge yet" until we have confirmation that the CSS side is table. |
CSS side is stable and the FPWD for CSS Display 4 is expected to be published this week. Edit: Linked the wrong comment: w3c/transitions#685 (comment) |
My best understanding is that the CSS WG does not consider it stable. That's what they also said during the last joint meeting. |
Sorry, I realized I linked the wrong comment previously. My understanding is that the CSSWG discussed the topic last week and resolved that the CSS Display level 4, which includes the spec for reading-flow can move to FPWD: w3c/csswg-drafts#6900 (comment) Further, as fantasai mentioned above, "The stability of the feature on the CSS side shouldn't matter, ideally, because the HTML spec is written in a way that doesn't care how CSS defines the reading order." This is true since all we do is reference the concepts of "reading flow container" and "rendering-defined sibling reading flow" from the CSS spec. Tabindex and focus navigation scopes are all HTML concepts. I believe we can remove the label "do not merge yet" and this PR is ready as is. |
The spec is now published on TR https://www.w3.org/TR/css-display-4/ my understanding is that the outstanding CSS things to discuss shouldn't impact the HTML side, as Di mentioned in her comment. |
RE #10613 (comment): this is great to hear! I'll remove the do not merge label from our end, given that update. |
My understanding is different and I'd appreciate it if you could leave the label intact. |
@annevk can you explain what you are concerned about (and the relationship to the HTML spec) so we can get those issues prioritized in the CSSWG? I'd be happy to focus on the issues that allow us to get this landed. |
@fantasai raised a number of issues on the CSS side and I believe she intends to raise more. And we need the CSS side to be stable (which FPWD does not indicate at all; the CSS WG is quite notorious for renaming things late in the game) to be able to fully test this feature end-to-end, which is a pre-requisite for our criteria: https://whatwg.org/working-mode#changes. (@fantasai did indicate above that she hoped that it didn't matter whether the CSS side was stable or not, but it does matter to our process.) |
@fantasai if you have more issues in mind, could you raise them? I can get them on the agenda and work through them once we know what they are. |
We should move the conversation about CSS+HTML integration to w3c/csswg-drafts#11328 and keep this PR about HTML spec changes only. |
The CSSWG resolved to add the new CSS property reading-flow: (w3c/csswg-drafts#7387, spec). Chrome has been working on a prototype for how to change the sequential focus navigation order within a container that has reading-flow.
This PR specs the new CSS property reading-flow per proposal described at #10407.
(See WHATWG Working Mode: Changes for more details.)
/index.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )