A viewport change re-anchors the reel on the video that is playing, resolved by id rather than by a scroll position the change has already invalidated. That is what keeps a rotation on the same video. Mid-swipe it names the wrong one. setActive runs from onScroll's next frame, so a resize landing before that frame still reads the video being swiped *away from* -- and realignToActive writes its position straight to scrollTop, hauling the reel back to it. A phone slides its chrome on every scroll, so the resize lands mid-swipe on nearly every swipe: the reel went where the thumb put it, far enough to show the top of the next video at the bottom of the screen, and was then written back a beat later. The input guard in onScroll could not catch this. There is no scroll event to guard -- the write happens inside the resize. So while the reader is demonstrably driving, take the reel's own position as the authority and re-anchor on the step it is nearest at the new height. It still lands on a snap point, so nothing is left straddling two screens, but the swipe stands. Only a step's worth of disagreement counts as theirs: a scroller just re-parented into or out of the picture-in-picture window reads 0, and following that would land them on the first video instead of their own. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MPZFnNdHbPGDTqQUNiE4ZN
10 KiB
10 KiB