Bug 241493

Summary: Flashing when observed element is reparented in IntersectionObserver callback (without scroll anchoring)
Product: WebKit Reporter: Mike Taylor <miketaylr>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: fred.wang, rbuis, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Testcase none

Description Mike Taylor 2022-06-09 16:06:42 PDT
(sorry, bad title)

This was originally filed against the IntersectionObserver spec: https://github.com/w3c/IntersectionObserver/issues/472

STR: 
1. go to https://jsfiddle.net/90sw7dhf/
2. scroll down

Expected: in Firefox and Chrome, alternating green and blue divs, infinitely

Actual: in Safari TP, green turns blue, then a different shade of blue and that's it.

The jsfiddle has a log, and it seems like it's looping forever when trying to log "wow".
Comment 1 Radar WebKit Bug Importer 2022-06-13 10:48:43 PDT
<rdar://problem/95038984>
Comment 2 Simon Fraser (smfr) 2022-06-17 20:23:32 PDT
Created attachment 460325 [details]
Testcase
Comment 3 Simon Fraser (smfr) 2022-06-17 20:26:17 PDT
In both Chrome and Firefox there's a scroll position jump that happens when the elements are moved around. That might be a side effect of scroll anchoring, which Safari doesn't have.

Something similar happens in Firefox if I disable scroll anchoring, and that makes sense; moving the elements changes their intersection, which fires the callbacks, which changes the content.