Restore unpinned desktop stream scroll

This commit is contained in:
Frank Song committed 2026-07-31 22:24:25 +08:00
1 parent dd7f6ac318
commit 5c3ead61a2
3 files changed
+30 -9

No files matched your search

@@ -94,17 +94,19 @@ def test_content_visibility_scoped_to_user_rows():
)
def test_restore_same_frame_holds_position_for_unpinned_reader():
"""The absolute-top fallback must be skipped for an unpinned reader.
def test_restore_same_frame_holds_position_for_unpinned_touch_reader():
"""The absolute-top fallback must be skipped when native anchoring can hold.
When the reader is scrolled up (userUnpinned) and the anchor restore failed,
_restoreMessageScrollSnapshotSameFrame must NOT write an absolute snapshot.top
(it goes stale and nudges the viewport backward as scrollHeight grows, #5637).
It should hold position and return before the el.scrollTop write.
It should hold position and return before the el.scrollTop write. Desktop
intentionally falls through to the explicit fallback because it has no
native overflow-anchor layer.
"""
fn = _restore_same_frame_fn()
assert "snapshot.userUnpinned===true&&snapshot.pinned!==true" in fn, (
"The fallback must guard the unpinned/anchor-failed case (#5637)."
assert "snapshot.userUnpinned===true&&snapshot.pinned!==true&&_fbTouchHold" in fn, (
"The fallback must guard the unpinned/anchor-failed touch case (#5637)."
)
# The guard must sit BEFORE the absolute-top scrollTop write and short-circuit it.
guard_idx = fn.index("snapshot.userUnpinned===true&&snapshot.pinned!==true")