Bug 295003

Summary: [css-anchor-position-1] Scrolling anchor doesn't trigger fallback when anchored box's containing block is the scroller
Product: WebKit Reporter: fantasai <fantasai.bugs>
Component: Layout and RenderingAssignee: fantasai <fantasai.bugs>
Status: NEW    
Severity: Normal CC: bfulgham, kiet.ho, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 289743, 291856    
Attachments:
Description Flags
WIP none

fantasai
Reported 2025-06-25 19:09:24 PDT
Overview: In cases where the containing block of an anchored box is a scroll container that also contains the anchor, we are not triggering fallback as we scroll the box into to the edge of the containing block. WPTs assume that this is the required behavior, however. Affected WPT Tests: http://wpt.live/css/css-anchor-position/ * anchor-scroll-position-try-* * position-area-scrolling-00[567] * position-try-fallbacks-003 Specification Notes: It's not 100% clear what the correct behavior is, i.e. whether the anchored box is contained by the scroll container's outer padding edge, or by its inner (scrollable) padding edge. On the root element, only fixed-positioned boxes are contained by the scrollport edge; absolutely-positioned boxes are contained by the scrollable area (roughly speaking). So this might need some investigation.
Attachments
WIP (52.13 KB, patch)
2025-08-10 20:38 PDT, fantasai
no flags
Radar WebKit Bug Importer
Comment 1 2025-06-25 19:09:31 PDT
fantasai
Comment 2 2025-07-10 23:26:28 PDT
Discussed this with Tab, we agree that the tests where the containing block is the scroller are wrong -- scrolling these should not trigger fallback. But for the tests where the containing block is an ancestor of the scroller, those should trigger fallback.
fantasai
Comment 3 2025-08-10 20:38:56 PDT
Created attachment 476346 [details] WIP Attaching WIP. Still have a few failing tests to fix up (anchor-scroll-nested, anchor-scroll-to-sticky-002, and position-visibility-anchors-visible-change-anchor are newly failing, so I have to figure out why). But it fixes the first five anchor-scroll-position-try, and hopefully sets us up to pass the remaining ones once last-remembered-fallback is fixed, and also fixes the js-expose test.
fantasai
Comment 4 2025-08-13 00:15:35 PDT
Note You need to log in before you can comment on or make changes to this bug.