Re: [csswg-drafts] [css-lists] CSS counter scope/inheritance is incompatible with HTML ordinals (#5477)

> Is this the same issue? https://issues.chromium.org/issues/359623686

I think so. I encountered this problem when testing a stylesheet that uses `counters()` for nested section numbering, as shown in the following example:

```html
<style>
  section {
    counter-increment: section;
    margin-inline-start: 1em;
  }
  section:first-of-type {
    counter-reset: section;
  }
  section > :is(h1,h2,h3,h4,h5,h6):first-child::before {
    content: counters(section, ".") " ";
  }
</style>
<section>
  <h1>Section Level 1</h1>
  <section>
    <h2>Section Level 2</h2>
  </section>
  <section>
    <h2>Section Level 2, 2nd</h2>
    <section>
      <h3>Section Level 3</h3>
    </section>
    <section>
      <h3>Section Level 3, 2nd</h3>
    </section>
    <section>
      <h3>Section Level 3, 3rd</h3>
    </section>
  </section>
  <section>
    <h2>Section Level 2, 3rd</h2>
  </section>
</section>
<section>
  <h1>Section Level 1, 2nd</h1>
</section>
```

(CodePen: https://codepen.io/MurakamiShinyu/pen/KKjZVbR )

I was surprised that the latest Chrome (126 and later) does not work as expected, while Firefox and Safari work as expected, and I thought it is a bug in Chromium. Then I found this CSS issue.

I believe that reverting the spec change is the right decision, and I hope that all browsers will behave consistently.



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


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

Received on Saturday, 17 August 2024 13:17:47 UTC