[csswg-drafts] [css-lists] CSS counter scope description, example no longer accurate (#10491)

sbrand83 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-lists] CSS counter scope description, example no longer accurate ==
There are a couple places where I think the spec could be updated to be more clear for some of the more [recent changes around counter inheritance](https://drafts.csswg.org/css-lists/#changes-20200709) and the precedence of counters from the parent vs. the previous sibling. 

*Maybe these changes won't be necessary as the changes to the spec might be getting reverted? https://github.com/w3c/csswg-drafts/issues/5477#issuecomment-1843956580

(Recent versions of chromium just started adopting these changes, the latest stable chrome 126 has them implemented, which is how I noticed)

# Example 22
https://drafts.csswg.org/css-lists/#example-b1a4542d

Example 22 in the spec doesn't fully match the behavior as described in the spec anymore

Specifically, the [latest change to counter inheritance](https://drafts.csswg.org/css-lists/#changes-20200709) causes the last `h2` in the example to inherit the `h2` counter value that is copied from the `body` parent instead of the previous `h1` sibling's nested h2 counter. So instead of rendering 'B.1 First H2 in H1' it now renders 'B.3 First H2 in H1'.

The latest versions of chromium, starting in 126, started following this change in the spec.

Maybe just need to change the example to use `counter-set` instead of `counter-reset` for the `h1`, `h2`, and `h3` rules? Might be helpful to add some sort of note since this broke backwards compatibility to the current example. 

# Nested Counters and Scope
https://drafts.csswg.org/css-lists/#nested-counters

I think the description of the scope of a counter could be updated as well, as it seems that the scope doesn't extend to the element's following siblings in the case when there is a counter on the parent element of the same name.

> The scope of a [counter](https://drafts.csswg.org/css-lists/#counter) therefore starts at the first element in the document that [instantiates](https://drafts.csswg.org/css-lists/#instantiate-counter) that counter and includes the element’s descendants and its following siblings with their descendants. However, it does not include any elements in the scope of a counter with the same name created by a [counter-reset](https://drafts.csswg.org/css-lists/#propdef-counter-reset) on a later sibling of the element, allowing such explicit counter instantiations to obscure those earlier siblings.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10491 using your GitHub account


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

Received on Monday, 24 June 2024 23:09:52 UTC