aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/messages.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-20 12:13:31 -0700
committerAdam Soltys <[email protected]>2026-11-20 12:13:31 -0700
commitcfa932611272a26a8f8d3ca64d2b473245335bc1 (patch)
tree294244a3fbf7337c96ec5cc6a851a01233cc8040 /src/features/messages.js
parentc9f46cfb18bff34664fc5f65af70f31daa2d7d8d (diff)
downloadcoinosv3-cfa932611272a26a8f8d3ca64d2b473245335bc1.tar.gz
coinosv3-cfa932611272a26a8f8d3ca64d2b473245335bc1.zip
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.HEADmaster
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6Upic5L6MMJzkTn8zg
Diffstat (limited to 'src/features/messages.js')
-rw-r--r--src/features/messages.js24
1 files changed, 24 insertions, 0 deletions
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();