Bug 309239

Summary: [css-anchor-position-1] Element with display: contents doesn't establish an anchor scope when using anchor-scope
Product: WebKit Reporter: Gunnar Bittersmann <gunnar>
Component: Layout and RenderingAssignee: Kiet Ho <kiet.ho>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, fantasai.bugs, kiet.ho, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 291856    

Gunnar Bittersmann
Reported 2026-03-05 00:36:42 PST
Hi, this grid layout works fine in Firefox ans Chromium browsers: https://codepen.io/gunnarbittersmann/pen/OPRyObK The headings should be positioned above the first item of their section. In Safari (26.3 on macOS and iOS), all headings are stacked onto each other at the position of the last section heading, as it would look like in other browser without `anchor-scope` being set. May it be that `anchor-scope` doesn’t work well with `display: contents` on the same element?
Attachments
Radar WebKit Bug Importer
Comment 1 2026-03-12 01:37:11 PDT
Kiet Ho
Comment 2 2026-03-24 16:06:27 PDT
Hello, thank you for your report. We do have a bug where a display: contents element would not establish an anchor scope, even if anchor-scope is set. A patch is forthcoming.
Kiet Ho
Comment 3 2026-03-24 17:02:03 PDT
EWS
Comment 4 2026-03-25 15:23:00 PDT
Committed 309946@main (89983a32335b): <https://commits.webkit.org/309946@main> Reviewed commits have been landed. Closing PR #61288 and removing active labels.
EWS
Comment 5 2026-03-30 17:24:20 PDT
Committed 305413.596@safari-7624-branch (7cdb93183ef0): <https://commits.webkit.org/305413.596@safari-7624-branch> Reviewed commits have been landed. Closing PR #4854 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.