CSS counters buggy when used in elements with style containment (`container` or `contain:style`)
Categories
(Core :: Layout: Generated Content, Lists, and Counters, defect)
Tracking
()
People
(Reporter: stephenmerriman, Unassigned)
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Steps to reproduce:
Load the example here: https://jsfiddle.net/rgxLc46n/
Then press Ctrl-M to turn on responsive mode.
Actual results:
The counters change from 1, 2, 3, 4 to 2, 3, 4, 4. This does not happen if the container definition is removed.
Expected results:
CSS counters should be unaffected.
Note that this isn't restricted to responsive mode; I've had similar effects on proper HTML pages I'm working on by resizing the window past certain breakpoints that cause larger repaints (and sometimes the last counter changes to 0), but responsive mode is just being used as the simplest way to replicate this bug.
Reporter | ||
Comment 1•3 months ago
|
||
Sorry, Ctrl-Shift-M, obviously.
Comment 2•3 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Generated Content, Lists, and Counters' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•2 months ago
|
||
The severity field is not set for this bug.
:jwatt, could you have a look please?
For more information, please visit BugBot documentation.
Comment 4•2 months ago
|
||
Here's the reporter's testcase. I can reproduce.
The STR mention entering responsive design mode; but I can also reproduce by simply unchecking-re-checking the container
declaration in Firefox's devtools. (Maybe entering RDM has that same effect by disabling/reenabling various styles as part of activating mobile-emulation stuff? Not sure.)
Comment 5•2 months ago
|
||
Updated•2 months ago
|
Comment 6•2 months ago
|
||
container
here only matters insomuch as it makes the element behave as if it had contain:style
, I think.
Here's a testcase using contain:style
instead of container
. It still triggers the same issue.
Comment 7•2 months ago
|
||
With testcase 3, I can reproduce as far back as 2022-06-23
which is when contain:style
started being parsed (via bug 1463600 comment 71). So this was a bug in our contain:style implementation when it was added.
This is probably a duplicate of bug 1809505 ("Style containment not working well with counters on pseudo-elements"), based on the name and based on the fact that the testcase here and on bug 1809505 both result in a one-time +1
increase to the counters during what-should-be-a-no-op style invalidation.
Description
•