Float the typing indicator so it never fights an upward scroll (#918)#919
Merged
Conversation
The typing indicator lived inside the scrollable content (the virtualized list's footer row), so every XEP-0085 composing/paused toggle changed the scroll height and fired the re-pin effect that hauls the viewport back to the bottom. While scrolled up in history this "fought" the user's scroll. Render it instead as a floating pill anchored to the bottom of the message area — a sibling of the scroll-to-bottom FAB, outside the scroll content and outside the hasContent gate. Because it changes no scroll height it can never re-pin, and it stays visible whether the user is at the bottom or scrolled up (it also now shows in empty conversations). typingUsersCount is removed from useMessageListScroll; the re-pin effect is reactions-only. Adds regression tests that reproduce the fight (a typing toggle from a scrolled-up-but-latched state) and fail on the old behavior.
A reaction on the last message is an ambient change; forcing the viewport back
to the bottom when one arrives is the same annoyance the typing-indicator fix
removed. Delete the reassertBottom('reactions') effect and the
lastMessageReactionsKey plumbing entirely — a follower stays within
AT_BOTTOM_THRESHOLD, so the next real message still sticks to the bottom. Only
new messages and layout/container changes re-pin now.
Converts the previously-skipped reactions-scroll test into an active guard that
asserts a reaction does NOT scroll.
A reaction on the last message grows its row; when the reader is sticked to the bottom we keep it visible with a single smooth nudge rather than either the old hard pin loop or nothing. Two safeguards prevent it from ever fighting a scroll: it is gated on live geometry (not the latchable isAtBottomRef), so a scrolled-up reader is never nudged; and it fires only on an actual reactions change within the same conversation, so a switch/restore is never disturbed. Tests assert the smooth nudge fires when sticked and does not when scrolled up.
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.
Fixes #918.
Problem
The typing indicator lived inside the scrollable message content (the virtualized list's footer row). Each XEP-0085 composing/paused toggle changed the scroll height and fired the "re-pin to bottom" effect, so scrolling up through history while someone was typing produced heavy jitter — the viewport kept getting hauled back to the bottom.
Fix
Render the typing indicator as a floating pill anchored to the bottom of the message area (a sibling of the scroll-to-bottom FAB), outside the scroll content. Because it no longer affects scroll height, it can't trigger a re-pin, and it stays visible whether the user is at the bottom or scrolled up — matching the requirement that typing status show regardless of scroll position. It also now shows in empty conversations (previously gated behind
hasContent).typingUsersCountis removed fromuseMessageListScroll.Reactions: gentle nudge instead of a hard re-pin
A reaction on the last message grows its row. Rather than the old heavy pin loop (which could yank a scrolled-up reader) or nothing (leaving the reaction below the fold), it now gives a single smooth nudge — but only while the reader is genuinely sticked to the bottom. Two safeguards keep it from ever fighting a scroll:
getDistanceFromBottom < AT_BOTTOM_THRESHOLD), not the latchableisAtBottomRef— a reader scrolled up into history is never nudged.