@@ -52,10 +52,16 @@ export default function MessageList({
5252 }) {
5353 const list = useRef<HTMLDivElement>(null);
5454 const stick = useRef(true);
55+ // The scrollTop we last set ourselves. Our scroll-to-bottom can queue a
56+ // scroll event that is handled only after a lazy image grows the list, so
57+ // the gap to the bottom reads large even though the reader never scrolled.
58+ const pinnedTop = useRef<number | null>(null);
5559
5660 const scrollDown = () => {
5761 const el = list.current;
58- if (el) el.scrollTop = el.scrollHeight;
62+ if (!el) return;
63+ el.scrollTop = el.scrollHeight;
64+ pinnedTop.current = el.scrollTop;
5965 };
6066
6167 // Jump to the newest message on channel switch, whatever the old position.
@@ -81,7 +87,12 @@ export default function MessageList({
8187
8288 function onScroll() {
8389 const el = list.current;
84- if (el) stick.current = el.scrollHeight - el.scrollTop - el.clientHeight < 48;
90+ if (!el) return;
91+ if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) stick.current = true;
92+ // A scroll event still sitting where we pinned is ours, not a reader
93+ // scrolling up, so leave stick alone.
94+ else if (pinnedTop.current === null || Math.abs(el.scrollTop - pinnedTop.current) >= 1)
95+ stick.current = false;
8596 }
8697
8798 return (