Repository navigation
Keep the attendee chat pinned to the newest post - #268
Open
junkerderprovinz wants to merge 2 commits into
Open
junkerderprovinz wants to merge 2 commits into
junkerderprovinz wants to merge 2 commits into
Conversation
added 2 commits
November 18, 2026 21:02
The feed measured the distance to the bottom on every patch to decide whether to follow a new post. When the panel got shorter (focus slot, captions) or the newest post grew with a reply, a reader who never scrolled counted as scrolled up and the feed stopped following. Keep a follow flag instead that only the reader scrolling up clears, so neither the feed's own smooth scroll nor a post arriving during it turns following off. Re-pin when the feed grows or gets shorter, and leave the position alone on patches that do not make it taller.
junkerderprovinz
force-pushed
the
fix/attendee-chat-autoscroll
branch
from
November 18, 2026 20:02
50cbbb4 to
4696cbd
Compare
This branch has not been deployed
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 #264.
The attendee room already follows new posts while the reader is at the bottom (
RoomFeedon#chat-feed), but it can stop without the reader scrolling. The hook measured the distance to the bottom on every patch, so when the feed got shorter (the focus slot or captions taking space) or the newest post grew with a moderator reply, a reader who never scrolled counted as scrolled up, and every later post only showed the "new messages" chip. Busy rooms can also lose it another way: the hook's own smooth scroll fires scroll events, and a post that arrived mid-animation switched following off for good.The hook now keeps a follow flag. Only scrolling up clears it, and being within 48 px of the bottom sets it again, also after a resize or a patch that comes without a scroll event. It re-pins when the feed grows or gets shorter (a
ResizeObserver), and leaves the position alone on patches that don't make the feed taller, such as reaction counts or caption updates.There are two commits. The first moves the unchanged hook into
assets/js/room_feed.mjs, followingdate_time_local.mjs, so it can be tested. The second changes the behaviour and addsassets/test/room_feed_hook_test.mjs. The test mock plays smooth scrolls over several frames with scroll events in between, because that is where the race happens.I checked it in Chromium against a running server: two posts 45 ms apart, a reply on the newest post, a shrinking feed, and a reaction while the reader sits 30 px above the bottom. The old hook reproduced each problem; the new one follows, or stays put in the reaction case. Chromium ignores wheel input during a programmatic smooth scroll, so a reader scrolling up mid-animation is only covered by the unit test. There are no Elixir changes.
This shouldn't conflict with #251. Collapsing and expanding its chat panel resizes the feed, which the observer picks up.