diff options
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/messages.js | 24 |
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(); |
