aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/features/messages.js24
-rw-r--r--src/style.css7
-rw-r--r--tools/live-stream-test.js24
3 files changed, 53 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; }
diff --git a/tools/live-stream-test.js b/tools/live-stream-test.js
index 56dcb71..cf5e056 100644
--- a/tools/live-stream-test.js
+++ b/tools/live-stream-test.js
@@ -224,6 +224,30 @@ try {
const rowSel = '.live-message[data-key="' + chat.id + '"]';
check('comments use the group-chat bubble and shared composer', await page.$(rowSel + ' .chat-bubble') && await page.$('.live-page coinos-text#msg-draft'));
check('...drawn plain on a phone, no bubble walls', await page.evaluate((q) => { const b = document.querySelector(q); return b && getComputedStyle(b).borderStyle === 'none' && getComputedStyle(b).display === 'block'; }, rowSel + ' .chat-bubble'));
+ // the message box is on screen without scrolling the page: the chat takes
+ // the room left under the stream, down to the nav (it was a fixed 60vh and
+ // the card ran off the bottom, where a swipe inside the chat couldn't
+ // bring it up)
+ {
+ const fit = await page.evaluate(() => {
+ window.scrollTo(0, 0);
+ const r = (q) => document.querySelector(q)?.getBoundingClientRect();
+ const box = r('.live-page coinos-text#msg-draft'), nav = r('.app-bottom-nav'), chat = document.querySelector('.live-page .live-chat');
+ return { box: box && Math.round(box.bottom), nav: nav ? Math.round(nav.top) : innerHeight, chat: chat.clientHeight, behaviour: getComputedStyle(chat).overscrollBehaviorY };
+ });
+ check('on a phone the message box sits on screen, over the nav', fit.box && fit.box <= fit.nav && fit.chat >= 120, JSON.stringify(fit));
+ check('...and the chat no longer holds a scroll that reaches its end', fit.behaviour === 'auto');
+ // a wall of chat: the box stays where it is, the newest line just above it
+ await page.addStyleTag({ content: '.live-page .live-chat::before{content:"";flex:none;height:3000px}' }).then((el) => el.evaluate((n) => { n.id = 'tall-chat'; }));
+ await page.evaluate(() => { const c = document.querySelector('.live-page .live-chat'); c.scrollTop = c.scrollHeight; });
+ const tall = await page.evaluate(() => {
+ const r = (q) => document.querySelector(q)?.getBoundingClientRect();
+ const c = document.querySelector('.live-page .live-chat'), last = c.lastElementChild.getBoundingClientRect(), nav = r('.app-bottom-nav');
+ return { box: Math.round(r('.live-page coinos-text#msg-draft').bottom), nav: nav ? Math.round(nav.top) : innerHeight, last: Math.round(last.bottom), chatBottom: Math.round(c.getBoundingClientRect().bottom), pageY: window.scrollY };
+ });
+ check('...with a long chat too, the newest line showing above it', tall.box <= tall.nav && tall.last <= tall.chatBottom + 1 && tall.pageY === 0, JSON.stringify(tall));
+ await page.evaluate(() => document.getElementById('tall-chat')?.remove());
+ }
check('another client’s e-only reaction arrives on the comment', await waitFor(id => document.querySelector('.live-message[data-key="'+id+'"] .chat-reacts')?.textContent.includes('👍'), 6000, chat.id));
check('per-comment zap receipts show under the bubble', await waitFor(id => document.querySelector('.live-message[data-key="'+id+'"] .zap-tally')?.textContent.includes('5'), 6000, chat.id));
await page.click(rowSel + ' .chat-bubble');