fix(scroll): keep sent messages stuck to the bottom on WebKit#769
Merged
Conversation
The pin-to-bottom loop bailed on a position-derived `isAtBottomRef`, which WebKit corrupts: a tall just-sent row grows after paint and the engine fires extra scroll events during the pin. handleScroll's height-unchanged discriminator only catches the first one (it advances prevScrollHeightRef on every event), so a growth that settles across two scroll events slips through, flips isAtBottom false, and the pin bails — stranding the message below the fold. That is the recurring send-stick bug (#673/#683/#724/#760 each patched one variant of the same position-inference leak). The pin now yields only to genuine user intent (wheel/FAB, via userScrollIntentAtRef) and otherwise keeps converging on real geometry until the bottom is reached or its frame budget ends, re-deriving isAtBottom from real geometry on exit. It no longer reads the corrupted position flag, so it is robust to any pattern of WebKit growth-settle scroll events rather than to the specific cases patched before. Adds a scroll-invariant modelling the two-event growth settle the single-event #760 test does not cover (RED before, GREEN after), passing on chromium and webkit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sending a message did not stick to the bottom on WebKit (Safari + Tauri): the just-sent message stayed below the fold instead of scrolling into view.
Fix
Gate the pin on intent, not position. The pin-to-bottom loop now yields only to a genuine user takeover (wheel / FAB, via
userScrollIntentAtRef) and otherwise keeps converging on real geometry until the bottom is reached or its frame budget ends, re-derivingisAtBottomfrom real geometry when the budget ends. It no longer reads the corrupted position flag, so it is robust to any pattern of WebKit growth-settle scroll events rather than to the specific cases patched before.Trade-off: within the ~1s pin window after a send, a non-wheel scroll-up (touch, arrow keys, dragging the scrollbar thumb) is pulled back to the bottom. On desktop Safari/Tauri (trackpad/wheel) this is not reached, and it matches the intended "send reveals your message" behaviour.
Adds a scroll-invariant modelling the two-event growth settle that the single-event #760 test does not cover (RED before the fix, GREEN after), passing on chromium and webkit.