Skip to content

Float the typing indicator so it never fights an upward scroll (#918)#919

Merged
mremond merged 3 commits into
mainfrom
fix/918-typing-indicator-scroll-jitter
Jul 8, 2026
Merged

Float the typing indicator so it never fights an upward scroll (#918)#919
mremond merged 3 commits into
mainfrom
fix/918-typing-indicator-scroll-jitter

Conversation

@mremond

@mremond mremond commented Jul 8, 2026

Copy link
Copy Markdown
Member

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). typingUsersCount is removed from useMessageListScroll.

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:

  • Gated on live geometry (getDistanceFromBottom < AT_BOTTOM_THRESHOLD), not the latchable isAtBottomRef — a reader scrolled up into history is never nudged.
  • Fires only on an actual reactions change within the same conversation, so a conversation switch / scroll restore is never disturbed.

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.
@mremond mremond added this to the 0.17.1 milestone Jul 8, 2026
mremond added 2 commits July 8, 2026 16:39
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.
@mremond mremond merged commit fd1dc50 into main Jul 8, 2026
3 checks passed
@mremond mremond deleted the fix/918-typing-indicator-scroll-jitter branch July 8, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typing indicator causes scroll jitter when scrolling up in chat

1 participant