Repository navigation
Add support for CSS reading-flow - #10613
dizhang168 wants to merge 25 commits into
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
annevk
left a comment
There was a problem hiding this comment.
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.
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 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. |
domfarolino
left a comment
There was a problem hiding this comment.
OK I've done another pass and I think this LGTM to me. There are two things I find a little funny but not blocking.
- It's a little strange that nothing actually calls the reading flow order "algorithm" like a normal algorithm, despite it being written algorithmically. This is an artifact of how focus navigation scopes are constructed—they are not done so algorithmically, but rather descriptively. Therefore the reference to how they're ordered by "tabindex value" is also descriptive, instead of calling the algorithm and working on its return value etc. This quirk predates this PR, and we pile on with how we reference reading flow order—the definition is written very algorithmically and has a return value and everything, but we reference it descriptively. I think this is fine since it sets us up for a more ideal future where all of these things become more algorithmic in nature, but it's just worth pointing out.
- The second thing is we're introducing another ordering type for focus navigation scopes but we're keeping the old name—that mentions "tabindex-ordered" directly—for the general concept of all ordered scopes: "tabindex-ordered focus navigation scope" and "flattened tabindex-ordered focus navigation scope". We sidestep this weirdness by specializing some "tabindex-ordered focus navigation scopes" to actually be "reading-flow-ordered focus navigation scopes", which isn't totally weird since reading-flow-ordered scopes are still partially influenced by tabindex. Another way to do this would be to rename all of the tabindex-ordered scopes to a generic "ordered focus navigation scope" and require that some kind of order type (tabindex value or reading flow) be supplied in order to use them. I'm not sure it's necessary, but I'd also be fine with this as a follow-up or general refactoring to this area. I'm fine with things as they are though.
| <li><p>If <var>element</var> is in the <span data-x="popover-showing-state">popover showing | ||
| state</span> and has a <span>popover invoker</span> set, then return <var>element</var>.</p></li> | ||
|
|
||
| <li><p>If <var>element</var>'s parent is a <span>reading-flow-ordered scope owner</span>, then |
There was a problem hiding this comment.
At some point we should probably make all of the items in this list properly link to "parent", but keeping consistency in this PR, as you do, is I think fine.
|
Two comments here:
The dialog is opened with
But it seems like if |
…dered focus navigation scopes CSS Display 4 §4: reading-flow (normal | source-order | flex-visual | flex-flow | grid-rows | grid-columns | grid-order) and reading-order (<integer>) in the style system - parsed, computed, serialized - neither affecting anything drawn. whatwg/html#10613 (sequential focus navigation): a reading flow container (a block, flex or grid container whose reading-flow applies and is not normal), a display: contents element whose CSS parent box is one, and each reading flow item (an element whose parent element is such an owner) are focus navigation scope owners; an owner's scope is ordered by the reading flow order - the container's rendering-defined sibling reading flow, each item's first inclusive ancestor in the scope, then the rest of the scope in tree order - with tabindex deciding only focusability (src/html/reading_flow.zig, focus_navigation.zig). Without a renderer the sibling reading flow is the box children in order-modified document order, then by reading-order; flex-visual, grid-rows and grid-columns take that order too (stated: the visual positions are a renderer's). Golden rule 2: the newer spec. Chrome ships it (shadow-dom/focus-navigation/reading-flow/source-order-valid.html: Chrome 157 5/5, Firefox 160 0/5, Safari 27.2 0/5; css/css-display/reading-flow/*-valid and *-computed: Chrome only); whatwg/html#10613 is open with engine bugs open in all three (Chromium 40932006, Gecko 1854017, WebKit 285029).
… (tip incl. tonight's merges): 1,899,048 -> 1,899,516 passing, 0 losses, 0 crashes; css2's 6 unblocked: CSS.highlights (WebIDL maplike in codegen + the V8 binding, Highlight setlike<AbstractRange>, HighlightRegistry per Window), an inserted @import is fetched and data: style sheets apply synchronously (Chrome's static-data model; HTMLLinkElement-load-event), reading-flow/reading-order + reading-flow-ordered focus scopes (whatwg/html#10613, Chrome ships), Element.scrollIntoView updates style first and the runner's Element Click step 5 calls it (fullscreen-css-transition), view-transition pseudo-elements run their animations + getAnimations({pseudoElement, subtree}) (Firefox = spec); TimelineTrigger follows-majority entry. CSSStyleProperties accessors held back (+1.2 MB/isolate; lane css3). Bug-finding PASS (one known sweep-load flake); lifetime 558/558 x3; timers equal; window2 dom clean; gates green both OSes. Cost within the bar except page.fetch memory 1.041 - RULED by the user 2026-11-19 as a build-layout level shift (scoped).
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 )