commit 78e92f2ad8da7b9f2506ae3faf93fb6dec3fd589
parent 195d8681c0815d3dfee99d52122440e56e75b469
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 19 Nov 2026 20:16:25 -0500
Merge lane/browser-clip: the clip panel and "your copy" bar are reachable in a short window
The column under the player scrolls on its own and stops above the sticky
action strip, so "Save clip" and every other control of the visitor's-copy
bar and clip panel can be clicked at 1280x720 and at phone size. While the
clip panel is open the player gives the column room; closed, the player is
as it was at every window size.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
7 files changed, 265 insertions(+), 8 deletions(-)
diff --git a/common/components/LocalClipPanel.tsx b/common/components/LocalClipPanel.tsx
@@ -138,6 +138,23 @@ export function LocalClipPanel() {
wasSaving.current = savingNow;
}, [savingNow]);
+ // While the panel shows, the player gives the modal's column room on a
+ // short window (export/app/globals.css, [data-local-clip-open]): once on
+ // opening and once on closing, never on a state change within it.
+ useEffect(() => {
+ if (!shown) return;
+ const root = document.documentElement;
+ root.setAttribute("data-local-clip-open", "");
+ return () => root.removeAttribute("data-local-clip-open");
+ }, [shown]);
+
+ // Opened, or a new state in it (ready, saving, saved…): the group is
+ // brought into the modal column's view, above its pinned action strip.
+ const phase = job.phase;
+ useEffect(() => {
+ if (shown && groupRef.current) revealInScroller(groupRef.current);
+ }, [shown, phase]);
+
const close = () => {
const cancelled = closeLocalClip();
setClosedNote(cancelled ? cancelledSentence(cancelled) : "");
@@ -224,6 +241,25 @@ export function LocalClipPanel() {
);
}
+// Scrolls the nearest scrolling ancestor — and only it — so `el` is inside its
+// scrollport less the scroll padding (the modal column pads its bottom by the
+// sticky action strip's height). scrollIntoView would also scroll every other
+// ancestor and the page behind the modal; its `container` option is not in
+// every browser yet.
+function revealInScroller(el: HTMLElement) {
+ let box = el.parentElement;
+ while (box && !/(auto|scroll)/.test(getComputedStyle(box).overflowY)) box = box.parentElement;
+ if (!box) return;
+ const st = getComputedStyle(box);
+ const b = box.getBoundingClientRect();
+ const r = el.getBoundingClientRect();
+ const top = b.top + (parseFloat(st.scrollPaddingTop) || 0);
+ const bottom = b.bottom - (parseFloat(st.scrollPaddingBottom) || 0);
+ // Its bottom edge into view, unless that would hide its top.
+ if (r.bottom > bottom) box.scrollTop += Math.min(r.bottom - bottom, r.top - top);
+ else if (r.top < top) box.scrollTop -= top - r.top;
+}
+
function Actions({ children }: { children: React.ReactNode }) {
return <div className="flex flex-wrap items-center gap-2">{children}</div>;
}
diff --git a/common/components/LocalFileBar.tsx b/common/components/LocalFileBar.tsx
@@ -61,7 +61,7 @@ export function LocalFileBar() {
role="group"
aria-label="Your copy"
data-testid="local-file-bar"
- className="mx-3 sm:mx-0 flex flex-wrap items-center gap-x-2 gap-y-1 rounded-lg bg-zinc-900/80 ring-1 ring-white/10 p-2 text-xs text-zinc-200"
+ className="shrink-0 mx-3 sm:mx-0 flex flex-wrap items-center gap-x-2 gap-y-1 rounded-lg bg-zinc-900/80 ring-1 ring-inset ring-white/10 p-2 text-xs text-zinc-200"
>
<span className="min-w-0 max-w-full truncate">
Your copy: <span className="text-white">{localFile.name}</span>
diff --git a/common/components/PlayerProvider.tsx b/common/components/PlayerProvider.tsx
@@ -1332,7 +1332,7 @@ export function PlayerProvider({
{children}
{showPlayer && (
- <div className={containerClass} aria-hidden={displayMode === "hidden"}>
+ <div className={containerClass} aria-hidden={displayMode === "hidden"} data-testid="player-slot">
{localActive && local ? (
// The visitor's own copy, from its object URL, on the cue clock:
// every seek goes in at cue + offset and every tick comes out at
diff --git a/common/components/TranscriptModal.tsx b/common/components/TranscriptModal.tsx
@@ -298,14 +298,24 @@ export default function TranscriptModal() {
onClick={() => setDisplayMode("mini")}
className="absolute inset-0 bg-black/70 backdrop-blur-sm"
/>
- <div className="relative flex flex-col items-center w-full h-full overflow-hidden pointer-events-none">
+ {/* overflow-clip, not -hidden: a clip is not a scroll container, so
+ focus or scrollIntoView can never scroll the whole column up under
+ the player, and the action strip's `sticky` belongs to the column. */}
+ <div className="relative flex flex-col items-center w-full h-full overflow-clip pointer-events-none">
{/* The column that sits UNDER the player. Its top margin and its height
are derived from the same --player-w/--player-top the player itself
is positioned with (globals.css), so the two can't drift apart.
Below sm it takes the full remaining height, which is what makes the
- cue list tall and the action strip land on the bottom edge. */}
+ cue list tall and the action strip land on the bottom edge.
+ When what sits above the cue list is taller than the room (a short
+ window, the "Your copy" bar with its clip panel open), the COLUMN
+ scrolls: the action strip stays pinned to its bottom edge, the cue
+ list keeps a few lines, and nothing ends up under the strip — the
+ scroll padding is the strip's height, so focus and scrollIntoView
+ stop above it. */}
<div
- className="w-(--player-w) pointer-events-auto flex flex-col gap-2 sm:gap-3 max-sm:h-full"
+ data-testid="modal-column"
+ className="w-(--player-w) pointer-events-auto flex flex-col gap-2 sm:gap-3 max-sm:h-full overflow-y-auto overscroll-contain scroll-pb-[calc(4rem+env(safe-area-inset-bottom,0px))] sm:scroll-pb-16"
style={{
marginTop:
"calc(var(--player-top) + var(--player-w) * 9 / 16 + 0.75rem)",
@@ -365,7 +375,7 @@ export default function TranscriptModal() {
<div
ref={scrollRef}
data-testid="cue-list"
- className="flex-1 min-h-0 overflow-y-auto overscroll-contain touch-pan-y border border-zinc-700 bg-zinc-900 rounded-none sm:rounded-lg"
+ className="flex-1 min-h-24 overflow-y-auto overscroll-contain touch-pan-y border border-zinc-700 bg-zinc-900 rounded-none sm:rounded-lg"
>
{isDigest ? (
<DigestPanel
@@ -415,7 +425,7 @@ export default function TranscriptModal() {
{/* Action strip, pinned to the bottom edge. The clip/share group
scrolls sideways when it doesn't fit; the window group never does,
so Close is reachable at any width without a horizontal scroll. */}
- <div className="shrink-0 sticky bottom-0 flex items-stretch gap-2 bg-zinc-900/80 ring-1 ring-white/10 rounded-none sm:rounded-lg p-2 pb-[calc(0.5rem+env(safe-area-inset-bottom,0px))] sm:pb-2">
+ <div className="shrink-0 sticky bottom-0 flex items-stretch gap-2 bg-zinc-900/80 ring-1 ring-inset ring-white/10 rounded-none sm:rounded-lg p-2 pb-[calc(0.5rem+env(safe-area-inset-bottom,0px))] sm:pb-2">
<div className="flex-1 min-w-0 flex items-center gap-2 overflow-x-auto">
<ControlButton
title="Mark clip start at current time"
diff --git a/export/CHANGELOG.md b/export/CHANGELOG.md
@@ -1,6 +1,15 @@
# Changelog
## [Unreleased]
+- **Nothing in the video window hides under its action strip.** When what sits above the cue list is taller than
+ the room under the player (the "Your copy" bar with **Clip my copy** open, a short window), the column under the
+ player scrolls, the strip (Clip in, Clip out, Share, …) stays pinned to its bottom edge, and the cue list keeps a
+ few lines. Before, at 1280×720, **Save clip** sat under the strip and could not be clicked. The clip panel is
+ scrolled into view when it opens and when its state changes.
+- **While Clip my copy is open, the player leaves the panel room on a laptop-height window.** From 640 px wide,
+ with the panel open, the player is never so tall that the column under it gets less than 18rem: at 1280×720 the
+ video is 612 px wide instead of 960 while the panel shows, and the panel and a few cues fit under it. It resizes
+ once on opening and once on closing. Every other time the player is exactly the size it was.
- **Clip my copy: cut a clip from your own file, in the browser.**
- With your own copy playing, **Clip my copy** (in the "Your copy" bar) cuts the clip between the **Clip in** and
**Clip out** marks from that file. The marks are on the transcript's clock; your offset is applied.
diff --git a/export/app/globals.css b/export/app/globals.css
@@ -30,6 +30,19 @@ body {
--player-w: min(92vw, 960px);
--player-top: 4rem; /* was `top-16` */
}
+ /* While "Clip my copy" is open (LocalClipPanel sets the attribute), the
+ player is never so tall that the modal's column under it gets less than
+ 18rem, so the panel and a few cues show at a laptop-height window
+ (1280×720 left that column 92px). Every other time the player is the
+ size above. The floor keeps a landscape phone's player usable; the
+ column scrolls there. */
+ :root[data-local-clip-open] {
+ --player-w: clamp(
+ min(92vw, 20rem),
+ (100dvh - 4rem - 1.5rem - 18rem) * 16 / 9,
+ min(92vw, 960px)
+ );
+ }
}
/* Safe-area padding for the sticky bars (composer, selection toolbar, the
diff --git a/export/e2e/local-clip.spec.ts b/export/e2e/local-clip.spec.ts
@@ -1,4 +1,4 @@
-import { expect, test, type Page, type Request } from "@playwright/test";
+import { expect, test, type Locator, type Page, type Request } from "@playwright/test";
import { execFileSync, spawnSync } from "node:child_process";
import { readFileSync, writeFileSync } from "node:fs";
import { expectModalOpen } from "./helpers";
@@ -590,3 +590,192 @@ test.describe("export — clip your own copy in the browser", () => {
await expect(page.getByRole("button", { name: "Clip my copy" })).toBeFocused();
});
});
+
+// EVERY CONTROL REACHABLE, AT A LAPTOP'S AND A PHONE'S SIZE. The modal's
+// action strip (Clip in / Clip out / Share / …) is sticky at the column's
+// bottom edge; nothing of the "Your copy" bar or the clip panel may end up
+// under it, in either layout and in any state of the panel. "Reachable" is
+// what a keyboard or a scroll gives: the control scrolled into view the way
+// focus scrolls it, then the point at its centre must hit the control itself.
+// The saves are made by a real pointer click at that point, not by a locator
+// click (which scrolls and retries until something works).
+
+async function hitAtCentre(loc: Locator): Promise<{ ok: boolean; x: number; y: number; at: string }> {
+ await expect(loc).toBeVisible();
+ return loc.evaluate((el) => {
+ el.scrollIntoView({ block: "nearest", inline: "nearest" });
+ const r = el.getBoundingClientRect();
+ const x = r.left + r.width / 2;
+ const y = r.top + r.height / 2;
+ const top = document.elementFromPoint(x, y);
+ const ok = top !== null && (top === el || el.contains(top));
+ return { ok, x, y, at: top ? top.outerHTML.slice(0, 160) : "nothing" };
+ });
+}
+
+async function expectReachable(loc: Locator, what: string) {
+ const hit = await hitAtCentre(loc);
+ expect(hit.ok, `${what}: the point at its centre (${Math.round(hit.x)}, ${Math.round(hit.y)}) hits ${hit.at}`).toBe(true);
+}
+
+// A real pointer click at the control's (uncovered) centre.
+async function pointerClick(page: Page, loc: Locator, what: string) {
+ const hit = await hitAtCentre(loc);
+ expect(hit.ok, `${what}: the point at its centre (${Math.round(hit.x)}, ${Math.round(hit.y)}) hits ${hit.at}`).toBe(true);
+ await page.mouse.click(hit.x, hit.y);
+}
+
+// The file is read slowly while window.__slowRead is set (100 ms per 64 KiB),
+// so a save is still running when Cancel is looked at. It is set from the
+// start: what the clipper reads while preparing it may keep.
+async function switchableSlowRead(page: Page) {
+ await page.addInitScript(() => {
+ const w = window as unknown as { __slowRead: boolean };
+ w.__slowRead = true;
+ const orig = Blob.prototype.stream;
+ Blob.prototype.stream = function (this: Blob) {
+ const reader = orig.call(this).getReader();
+ return new ReadableStream({
+ async pull(controller) {
+ const { done, value } = await reader.read();
+ if (done) return controller.close();
+ if (w.__slowRead) await new Promise((r) => setTimeout(r, Math.ceil(value.byteLength / 65536) * 100));
+ controller.enqueue(value);
+ },
+ cancel(reason) {
+ return reader.cancel(reason);
+ },
+ });
+ } as typeof Blob.prototype.stream;
+ });
+}
+const slowRead = (page: Page, on: boolean) =>
+ page.evaluate((v) => {
+ (window as unknown as { __slowRead: boolean }).__slowRead = v;
+ }, on);
+
+// The player's width with no clip panel open: what it was before "Clip my
+// copy" (min(92vw, 960px) from sm, 100vw below).
+const PLAYER_W: Record<number, number> = { 1280: 960, 390: 390 };
+const PANEL_OPEN_ROOM = 288; // 18rem
+const playerWidth = (page: Page) => page.getByTestId("player-slot").evaluate((el) => Math.round(el.getBoundingClientRect().width));
+const columnRoom = (page: Page) => page.getByTestId("modal-column").evaluate((el) => Math.round(parseFloat(getComputedStyle(el).maxHeight)));
+
+const SIZES = [
+ { name: "a laptop, 1280×720", viewport: { width: 1280, height: 720 } },
+ { name: "a phone, 390×844", viewport: { width: 390, height: 844 } },
+] as const;
+const LAYOUTS = [
+ { name: "the source no longer public (no player)", id: "synthmem001", gone: true },
+ { name: "a public source (the player gives way to the copy)", id: "synthpub001", gone: false },
+] as const;
+
+for (const size of SIZES) {
+ for (const layout of LAYOUTS) {
+ test.describe(`export — every control of your copy is reachable on ${size.name}, ${layout.name}`, () => {
+ test.skip(!FFMPEG, "ffmpeg/ffprobe not on PATH");
+ test.use({ viewport: size.viewport });
+
+ test("the bar, and the clip panel ready, saving, saved and refused", async ({ page }, info) => {
+ test.setTimeout(120_000);
+ const src = info.outputPath("synth-big.webm");
+ // Past the reader's 8 MiB cache, so a save reads (slowly) again.
+ makeMedia(src, "webm", { seconds: 20, heavy: true });
+ await installMissingSourceRoutes(page, { cues: CUES });
+ await stillPlayback(page);
+ await stubSavePicker(page);
+ await switchableSlowRead(page);
+ await page.goto(`/?v=${slugOf(layout.id)}`);
+ // The dev server's own issue badge sits over the bottom-left corner;
+ // it is not part of the page.
+ await page.addStyleTag({ content: "nextjs-portal { display: none !important; }" });
+ await expectModalOpen(page);
+ // The player is its usual size — min(92vw, 960px) from sm, the full
+ // width below — with a platform player or none, and with a copy
+ // playing; only an open clip panel makes it give the column room.
+ await expect.poll(() => playerWidth(page)).toBe(PLAYER_W[size.viewport.width]);
+
+ // Before the pick: the control, and (no player) the panel's last line.
+ if (layout.gone) {
+ const panel = page.getByTestId("source-missing");
+ await expectReachable(panel.getByRole("button", { name: "Play your own copy" }), "Play your own copy");
+ await expectReachable(panel.getByText("Your file stays in this browser: nothing is uploaded."), "the panel's last line");
+ } else {
+ await expectReachable(page.getByTestId("local-file-offer").getByRole("button", { name: "Play your own copy" }), "Play your own copy");
+ }
+ await expect(page.getByRole("button", { name: "Play your own copy" })).toBeVisible();
+ await page.getByTestId("local-file-input").setInputFiles({ name: "my-synth-big.webm", mimeType: CODECS.webm.mime, buffer: readFileSync(src) });
+ await expect(video(page)).toHaveAttribute("src", /^blob:/);
+
+ await expect.poll(() => playerWidth(page)).toBe(PLAYER_W[size.viewport.width]);
+
+ // The bar: its offset strip and every control in it.
+ const bar = page.getByTestId("local-file-bar");
+ await expectReachable(bar.getByTestId("local-file-offset"), "the offset");
+ for (const name of ["Offset −1 second", "Offset −0.1 second", "Offset +0.1 second", "Offset +1 second", "This line is playing now", "Stop using my copy"]) {
+ await expectReachable(bar.getByRole("button", { name }), name);
+ }
+ for (const text of ["clip line two", "clip line eleven"]) {
+ await expectReachable(page.locator("li", { hasText: text }).getByRole("button"), `the cue "${text}"`);
+ }
+ await markClip(page, "clip line two", "clip line eleven");
+ await pointerClick(page, clipToggle(page), "Clip my copy");
+
+ // Ready.
+ const group = clipGroup(page);
+ await expect(group.getByTestId("local-clip-start")).toBeVisible({ timeout: 30_000 });
+ // The panel open: the column under the player has at least 18rem.
+ await expect.poll(() => columnRoom(page)).toBeGreaterThanOrEqual(PANEL_OPEN_ROOM);
+ const openWidth = await playerWidth(page);
+ if (size.viewport.width === 1280) expect(openWidth).toBe(612);
+ else expect(openWidth).toBe(PLAYER_W[size.viewport.width]);
+ for (const name of ["Save clip", "Save the clip to a file you choose", "Close the clip"]) {
+ await expectReachable(group.getByRole("button", { name }), name);
+ }
+ await expectReachable(group.getByRole("link", { name: "licence" }), "the licence link");
+ await expectReachable(group.getByRole("link", { name: "source" }), "the source link");
+
+ // Saving: the progress and Cancel, then a real click on Cancel.
+ let downloads = 0;
+ page.on("download", () => downloads++);
+ await pointerClick(page, group.getByRole("button", { name: "Save clip" }), "Save clip");
+ await expect(group.getByRole("progressbar", { name: "Saving clip" })).toBeVisible();
+ await expectReachable(group.getByTestId("local-clip-progress"), "the progress");
+ await pointerClick(page, group.getByRole("button", { name: "Cancel the clip" }), "Cancel");
+ await expect(group.getByTestId("local-clip-cancelled")).toHaveText("Cancelled; nothing was saved.");
+ await expectReachable(group.getByRole("button", { name: "Close the clip" }), "Close, cancelled");
+ expect(downloads).toBe(0);
+
+ // Saved: a real click on "Save clip" gives the download.
+ await slowRead(page, false);
+ await pointerClick(page, group.getByRole("button", { name: "Close the clip" }), "Close");
+ await expect(clipGroup(page)).toHaveCount(0);
+ // Closed: the player is its usual size again.
+ await expect.poll(() => playerWidth(page)).toBe(PLAYER_W[size.viewport.width]);
+ await pointerClick(page, clipToggle(page), "Clip my copy, again");
+ await expect(group.getByTestId("local-clip-start")).toBeVisible({ timeout: 30_000 });
+ const download = page.waitForEvent("download");
+ await pointerClick(page, group.getByRole("button", { name: "Save clip" }), "Save clip");
+ const d = await download;
+ expect(d.suggestedFilename()).toBe(`${layout.gone ? TITLE_BASE : "Synth-public-talk"}_00h00m02s-00h00m11s.webm`);
+ const out = info.outputPath("clip.webm");
+ await d.saveAs(out);
+ expect(Math.abs(Number(ffprobe(out).format.duration) - 9)).toBeLessThan(0.12);
+ await expect(group.getByTestId("local-clip-done")).toBeVisible();
+ await expectReachable(group.getByRole("button", { name: "Close the clip" }), "Close, saved");
+ await pointerClick(page, group.getByRole("button", { name: "Close the clip" }), "Close");
+
+ // Refused: a file it cannot copy.
+ await pointerClick(page, bar.getByRole("button", { name: "Stop using my copy" }), "Stop");
+ await expect(page.getByRole("button", { name: "Play your own copy" })).toBeVisible();
+ await page.getByTestId("local-file-input").setInputFiles({ name: "my-synth-copy.wav", mimeType: "audio/wav", buffer: makeWav(12) });
+ await expect(video(page)).toHaveAttribute("src", /^blob:/);
+ await markClip(page, "clip line two", "clip line five");
+ await pointerClick(page, clipToggle(page), "Clip my copy, a WAV");
+ await expect(group.getByTestId("local-clip-refusal")).toBeVisible();
+ await expectReachable(group.getByTestId("local-clip-refusal"), "the refusal");
+ await expectReachable(group.getByRole("button", { name: "Close the clip" }), "Close, refused");
+ });
+ });
+ }
+}