diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/features/messages.js | 24 | ||||
| -rw-r--r-- | src/style.css | 7 |
2 files changed, 29 insertions, 2 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(); diff --git a/src/style.css b/src/style.css index a9ceadb..311cfbb 100644 --- a/src/style.css +++ b/src/style.css @@ -975,7 +975,10 @@ html.no-scroll { overflow: hidden; scrollbar-gutter: auto; } .live-rec-link { background: var(--paper); color: var(--ink); text-decoration: none; } .live-say { padding: 6px 12px; border-radius: 8px; color: #fff; background: rgba(0, 0, 0, .65); font-size: 14px; text-align: center; } /* the top padding is headroom for a hat on the first line's face: a scroller clips what rises out of it */ -.live-chat { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; padding-top: 12px; } +/* no overscroll-behavior here: at the end of the chat the swipe carries on to + the page, or the last lines and the message box stay under the screen edge + with no way to reach them (Adam, 2026-11-20) */ +.live-chat { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; min-height: 120px; overflow-y: auto; padding-top: 12px; } .live-line { display: flex; gap: 8px; align-items: flex-start; min-width: 0; } .live-line-body { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.35; } .live-zap .live-line-body b { color: var(--accent); } @@ -991,7 +994,7 @@ html.no-scroll { overflow: hidden; scrollbar-gutter: auto; } .live-page > .live-chat-card { margin-top: 0; padding-top: 6px; border-top: none; } .live-page > .card > :not(.live-player, .live-chat) { margin-left: 14px; margin-right: 14px; } .live-page .live-player { border-radius: 0; } - .live-page .live-chat { padding: 10px 14px 0; max-height: 60vh; } + .live-page .live-chat { padding: 10px 14px 0; max-height: var(--live-chat-max, 60vh); } .live-page .live-title { font-size: 17px; } .live-chat .chat-row { gap: 10px; } .live-chat .chat-bubble { display: block; background: transparent; border: 0; border-radius: 0; padding: 0; font-size: 15px; } |
