Closed Bug 1934755 Opened 3 months ago Closed 2 months ago

CSS counters buggy when used in elements with style containment (`container` or `contain:style`)

Categories

(Core :: Layout: Generated Content, Lists, and Counters, defect)

Firefox 133
defect

Tracking

()

RESOLVED DUPLICATE of bug 1809505

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.

Sorry, Ctrl-Shift-M, obviously.

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.

Component: Untriaged → Layout: Generated Content, Lists, and Counters
Product: Firefox → Core

The severity field is not set for this bug.
:jwatt, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jwatt)
Attached file testcase 1

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.)

Attachment #9445130 - Attachment description: testcase 2 (automatically deactivates/reactivates 'container' style) → testcase 2 (no interaction required; automatically deactivates/reactivates 'container' style)

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.

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.

Severity: -- → S3
Status: UNCONFIRMED → RESOLVED
Closed: 2 months ago
Duplicate of bug: 1809505
Flags: needinfo?(jwatt)
Resolution: --- → DUPLICATE
Summary: CSS counters buggy when used in CSS containers → CSS counters buggy when used in elements with style containment (`container` or `contain:style`)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: