From cfa932611272a26a8f8d3ca64d2b473245335bc1 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 20 Nov 2026 12:13:31 -0700 Subject: On a phone a live stream's message box stays on screen. "I tried to scroll down to see the bottom of the comments, but because the comments are in their own scroll context, the page wouldn't scroll even when I got to the bottom of the comments, so they were cut off at the bottom of the screen" (Adam, 2026-11-20). The chat was a fixed 60vh under the player, so the newest lines and the message box ran off the bottom of the screen, and the chat kept a swipe that reached its end to itself (overscroll-behavior: contain). The chat now takes the room left under the stream, down to the nav, so the message box and the newest line above it show without scrolling the page; it is measured again when the screen changes size (the keyboard). A long description leaves it a floor of 170px and the page scrolls. The chat no longer holds a scroll at its end either. live-stream-test checks the box sits over the nav, with a few lines and with 3000px of chat; features-smoke passes. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01VMan6Upic5L6MMJzkTn8zg --- src/features/messages.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/features/messages.js') diff --git a/src/features/messages.js b/src/features/messages.js index e36750e..57f0e23 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -10110,8 +10110,32 @@ export function messagesFeature(ctx) { if (!liveShown) { stopLivePlayer(); return; } mountLivePlayer(); const box = document.querySelector('.live-chat'); + fitLiveChat(box); if (box && box._stick !== false) box.scrollTop = box.scrollHeight; } + // On a phone the chat is as tall as the room left under the stream, so the + // message box (and the newest line above it) sits on screen, over the nav: + // at a fixed 60vh the card ran off the bottom, and a swipe inside the chat + // never moved the page to bring it up (Adam, 2026-11-20). A long + // description leaves little room: the chat keeps a floor and the page + // scrolls. On a variable of the document: a render takes inline styles back. + function fitLiveChat(box) { + const root = document.documentElement; + const card = box && box.closest('.live-chat-card'); + if (!card || !matchMedia('(max-width: 520px)').matches) { root.style.removeProperty('--live-chat-max'); return; } + const nav = document.querySelector('.app-bottom-nav'); + const b = box.getBoundingClientRect(); + const under = card.getBoundingClientRect().bottom - b.bottom; // the message box and the card's foot + const room = window.innerHeight - (nav ? nav.getBoundingClientRect().height : 0) - (b.top + window.scrollY) - under; + const px = Math.max(170, Math.floor(room)) + 'px'; + if (root.style.getPropertyValue('--live-chat-max') !== px) root.style.setProperty('--live-chat-max', px); + } + if (typeof window !== 'undefined') window.addEventListener('resize', () => { + const box = ui.liveStream && document.querySelector('.live-chat'); + if (!box) return; + fitLiveChat(box); + if (box._stick !== false) box.scrollTop = box.scrollHeight; + }); async function sendLiveChat(w, text, reply) { const id = await requireIdentity(); -- cgit v1.2.3