mdn / mdn/browser-compat-data

css.properties.contain.style - Safari behaves differently than Firefox/Chromium

Open
#18,576 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

browser:safari data:css
Dominant language
JSON
Stars
5.8k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
186

Description

What type of issue is this?

Browser bug (a bug with a feature that may impact site compatibility)

What information was incorrect, unhelpful, or incomplete?

Based on the documentation and example for the CSS contain property with a value of style, it appears no browser supports this feature as it is documented.

According to the contain compatibility list on MDN, the CSS contain: style property/value is supported in Chromium, Firefox, and Safari. The page includes an example of a 5-item list using a CSS counter, with the 3rd item using contain: style. The documentation explains that contain:style on the 3rd item would cause the CSS counter to begin again at 1.

Browsers do not order the list this way, nor do they order the list consistently.

  • Firefox and Chromium browser(s) count 1, 2, 1, 3, 4.
  • WebKit browser(s) count 1, 2, 3, 4, 5.

Related Question: Based on the documentation, should all browsers render as Firefox and Chromium? Or should the counter reset affect sibling elements, so that the counter order is 1, 2, 1, 2, 3?

If we adjust the example to move the check out from the exact list item using contain: style and into a child <div>, this inconsistency is not corrected. In fact, no browser agrees, and the browsers almost appear to disagree with themselves.

  • Chromium browser(s) now count 1, 2, 0, 4, 5.
  • Firefox browser(s) now count 1, 2, 3, 4, 5.
  • WebKit browser(s) now count 1, 2, 0, 1, 2.

Related Question: Based on the documentation, should all browsers render as Firefox and Chromium did in the first example? Or should the counter reset affect sibling elements, so that the counter order would be 1, 2, 1, 2, 3? Or something else?

CSS contain property references:

What browsers does this problem apply to, if applicable?

Chromium (Chrome, Edge 79+, Opera, Samsung Internet), Firefox, Safari

What did you expect to see?

I’m unsure. Based on the documentation, I most expected a result that no browser demonstrated.

Did you test this? If so, how?

See provided links

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

No response

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/contain#browser_compatibility

MDN metadata

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MDN contain compatibility table and its style-containment counter example, then reproduce both provided examples in Chromium, Firefox, and WebKit browsers. Determine the expected counter behavior from the CSS specification and whether the compatibility data or example is incorrect; done means documenting a supported conclusion and updating the relevant compatibility entry if warranted.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.