Panes: a covered pane peeks only with Shift or Control held, and a column is laid out again after a click on a peeking pane

A plain hover no longer peeks, so text being read does not jump and an
edge stays put to be dragged. A click on a peeking pane laid its column
out while the peek skewed the measurements; it is laid out again once
the pane is back, so the active pane takes its full height.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Fable 5.2 committed 2026-11-18 17:44:57 -05:00
1 parent 9dec4df1fd
commit 3f89c3cd2c
9 files changed
+302 -36

No files matched your search

+14 -3
View File
@@ -3,7 +3,7 @@
* drawn by the curve into it, in the pane's colour, as one stroke (measured in the pixels, at several
* device pixel ratios); a pane folded or scrolled past its title shows its tab and the curve lands in
* the tab's foot, and a curve out of a folded pane leaves from that foot; a pane's colour depends on
* the forest only; a covered pane peeks out across and down at once, and the wheel scrolls it; the
* the forest only; a covered pane peeks out across and down at once with Shift held, and the wheel scrolls it; the
* selection bar sits at its pane's level. Same build, mock model and mock Wikipedia as the others.
*/
import { expect, test, type Page } from "@playwright/test";
@@ -268,7 +268,7 @@ test("a pane folded or scrolled past its title shows its tab, and its curve land
expect(near(l.end.y, l.rule!.y)).toBe(true);
});
test("a pane covered across and down peeks out whole on both axes; the wheel scrolls it and it stays out; the selection bar of a pane under it is covered", async ({ page }) => {
test("a pane covered across and down peeks out whole on both axes with Shift held (not on a plain hover); the wheel scrolls it and it stays out; the selection bar of a pane under it is covered", async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 760 });
await library(page);
for (const t of ["The tides", "What a proof is", "The invention of writing", "Fixed points"]) await clickOpen(page, "Library", t);
@@ -283,7 +283,13 @@ test("a pane covered across and down peeks out whole on both axes; the wheel scr
await expect(tides).toHaveAttribute("data-covered", "");
const tb = (await tides.boundingBox())!;
const sp = { x: tb.x + 4, y: tb.y - 45, width: 20 };
// A plain hover, however long, leaves it covered.
await page.mouse.move(sp.x + sp.width / 2, sp.y + 60);
await page.waitForTimeout(450);
await expect(col).not.toHaveAttribute("data-peek", "");
await expect(tides).not.toHaveAttribute("data-peek", "");
// Shift pressed with the mouse resting there: out.
await page.keyboard.down("Shift");
await expect(col).toHaveAttribute("data-peek", "");
await expect(tides).toHaveAttribute("data-peek", "");
const vp = page.viewportSize()!;
@@ -306,6 +312,7 @@ test("a pane covered across and down peeks out whole on both axes; the wheel scr
// Away: back.
await page.mouse.move(vp.width - 10, vp.height / 2);
await expect(col).not.toHaveAttribute("data-peek", "");
await page.keyboard.up("Shift");
// The selection bar: shown in its pane; a pane peeking over it covers it.
const rec = pane(page, "Recursion without names");
@@ -322,7 +329,8 @@ test("a pane covered across and down peeks out whole on both axes; the wheel scr
const b = (await bar.boundingBox())!;
const at = { x: b.x + b.width / 2, y: b.y + b.height / 2 };
expect(await page.evaluate(({ x, y }) => !!document.elementFromPoint(x, y)?.closest(".selbar"), at)).toBe(true);
// Peek the top-level trees' column (to the left, covered): it slides out over the pane with the bar.
// Peek the top-level trees' column (to the left, covered), Shift held as the mouse comes onto it: it slides out over the pane with the bar.
await page.keyboard.down("Shift");
await page.mouse.move(sp.x + sp.width / 2, sp.y + 60);
await expect(col).toHaveAttribute("data-peek", "");
const over = await page.evaluate(({ x, y }) => {
@@ -333,4 +341,7 @@ test("a pane covered across and down peeks out whole on both axes; the wheel scr
expect(at.x).toBeLessThan(cb.x + cb.width);
expect(over).toEqual({ bar: false, peeked: true });
expect(await state(page, (s) => s.selectedText())).not.toBeNull();
// Shift let go: back.
await page.keyboard.up("Shift");
await expect(col).not.toHaveAttribute("data-peek", "");
});
+104 -5
View File
@@ -480,12 +480,16 @@ test("a crowded column stacks its panes as the strip stacks columns: covered par
expect(b[kids[0]].whole).toBe(true);
});
test("a pane resting covered peeks out under the mouse, over its neighbours without moving them; a click makes it active", async ({ page }) => {
test("a covered pane peeks out under the mouse only with Shift or Control held, over its neighbours without moving them; letting go puts it back; a click makes it active", async ({ page }) => {
const kids = await five(page);
const before = await boxes(page);
const tab = pane(page, kids[1]).locator(".tabline");
// A plain hover, however long, peeks nothing.
await tab.hover();
// Not at once: passing the mouse across does not flicker.
await page.waitForTimeout(450);
expect(await pane(page, kids[1]).getAttribute("data-peek")).toBeNull();
// Shift pressed with the mouse resting on it: out (not at once, so a capital typed does not flash it).
await page.keyboard.down("Shift");
expect(await pane(page, kids[1]).getAttribute("data-peek")).toBeNull();
await expect(pane(page, kids[1])).toHaveAttribute("data-peek", "");
const peeked = (await pane(page, kids[1]).boundingBox())!;
@@ -494,15 +498,35 @@ test("a pane resting covered peeks out under the mouse, over its neighbours with
// Nothing else moved.
const after = await boxes(page);
for (const t of kids) if (t !== kids[1]) expect(after[t].y).toBeCloseTo(before[t].y, 0);
// Leaving puts it back.
await page.mouse.move(5, 500);
// Letting go puts it back.
await page.keyboard.up("Shift");
await expect(pane(page, kids[1])).not.toHaveAttribute("data-peek", "");
// A click on it makes it the active pane, whole.
// Control works as Shift does; any other key, or the window losing the focus, puts it back too.
await page.keyboard.down("Control");
await expect(pane(page, kids[1])).toHaveAttribute("data-peek", "");
await page.evaluate(() => window.dispatchEvent(new Event("blur")));
await expect(pane(page, kids[1])).not.toHaveAttribute("data-peek", "");
await page.keyboard.up("Control");
// Held as the mouse comes onto it: out; leaving puts it back.
await page.mouse.move(5, 500);
await page.keyboard.down("Shift");
await tab.hover();
await expect(pane(page, kids[1])).toHaveAttribute("data-peek", "");
await page.keyboard.press("Shift+Escape");
await expect(pane(page, kids[1])).not.toHaveAttribute("data-peek", "");
await page.mouse.move(5, 500);
await page.keyboard.up("Shift");
// A click on it makes it the active pane, whole, and it goes back: the column laid out for it once it is back.
await tab.hover();
await page.keyboard.down("Control");
await expect(pane(page, kids[1])).toHaveAttribute("data-peek", "");
await pane(page, kids[1]).locator(".pane-head").click();
await page.keyboard.up("Control");
await expect(page.locator(".pane.active .pane-head h2")).toHaveText(kids[1]);
await expect(pane(page, kids[1])).not.toHaveAttribute("data-peek", "");
await still(page);
expect((await boxes(page))[kids[1]].whole).toBe(true);
expect(await pane(page, kids[1]).evaluate((el) => ["data-tab", "data-covered", "data-buried"].filter((a) => el.hasAttribute(a)))).toEqual([]);
// A column covered across the strip peeks too, raised over the columns past it.
await page.setViewportSize({ width: 1600, height: 1000 });
await page.evaluate(() => localStorage.clear());
@@ -511,7 +535,45 @@ test("a pane resting covered peeks out under the mouse, over its neighbours with
await expect.poll(async () => (await columns(page)).length).toBe(4);
await expect.poll(() => page.evaluate(() => document.querySelectorAll(".strip > .col")[0].hasAttribute("data-covered"))).toBe(true);
await page.locator(".strip > .col").nth(0).locator(".spine-title").hover();
await page.waitForTimeout(300);
await expect(page.locator(".strip > .col").nth(0)).not.toHaveAttribute("data-peek", "");
await page.keyboard.down("Shift");
await expect(page.locator(".strip > .col").nth(0)).toHaveAttribute("data-peek", "");
await page.keyboard.up("Shift");
});
test("a Shift- or Ctrl-click on a row of a peeking pane does what it does on any pane: Shift opens in place, Ctrl beside", async ({ page }) => {
const kids = await five(page);
/** Peek a covered pane, the modifier held, and click one of its rows with it. */
const peekRow = async (mod: "Shift" | "Control", inPane: string, row: string) => {
await page.mouse.move(5, 500);
// On what shows of it, below its grip.
const at = await pane(page, inPane).evaluate((el) => {
const r = el.getBoundingClientRect();
const c = el.parentElement!.getBoundingClientRect();
return { x: r.left + 60, y: Math.max(r.top, c.top) + 22 };
});
await page.mouse.move(at.x, at.y);
await page.keyboard.down(mod);
await expect(pane(page, inPane)).toHaveAttribute("data-peek", "");
await pane(page, inPane).locator(".row", { hasText: row }).first().click({ modifiers: [mod] });
await page.keyboard.up(mod);
await still(page);
};
const a = await childTitles(page, kids[1]);
const b = await childTitles(page, kids[3]);
// Shift: in place of the focused branch's pane in the next column (none there yet: it opens there).
await peekRow("Shift", kids[1], a[0]);
expect(await trail(page)).toEqual(["Explicata", kids[1], a[0]]);
expect((await columns(page))[2]).toEqual([a[0]]);
// Ctrl, in another pane covered in that column: beside what is open there, a fork of its own.
await peekRow("Control", kids[3], b[0]);
expect(await trail(page)).toEqual(["Explicata", kids[3], b[0]]);
expect((await columns(page))[2]).toEqual([a[0], b[0]]);
// Shift, back in the first: in place of its pane there; the other fork stays.
await peekRow("Shift", kids[1], a[1]);
expect(await trail(page)).toEqual(["Explicata", kids[1], a[1]]);
expect((await columns(page))[2]).toEqual([a[1], b[0]]);
});
test("a pane is dragged by its grip, or its tab, up or down its column; the order is kept, and Esc cancels", async ({ page }) => {
@@ -940,3 +1002,40 @@ test("side by side, a crowded column's edges resize too: the column is laid out
for (let i = 0; i < n - 2; i++) expect(Math.abs(c.panes[i].h - shown[i])).toBeLessThanOrEqual(1.5);
for (let i = 1; i < n; i++) expect(Math.abs(c.panes[i].top - (c.panes[i - 1].top + c.panes[i - 1].h))).toBeLessThanOrEqual(1);
});
test("an edge stays an edge with Shift held: resting on it, or pressing Shift there, peeks nothing, and it drags as without", async ({ page }) => {
await five(page);
let c = (await measured(page))[1];
const x = c.left + c.w / 2;
const n = c.panes.length;
const peeking = () => page.evaluate(() => document.querySelectorAll("[data-peek]").length);
// Plain hover on a covered pane, then Shift pressed on the edge between two of the column's tabs: no peek.
await page.mouse.move(x, c.panes[1].top + 12);
await page.waitForTimeout(300);
expect(await peeking()).toBe(0);
expect(await cursorAt(page, x, c.panes[2].top)).toBe("row-resize");
await page.keyboard.down("Shift");
await page.waitForTimeout(300);
expect(await peeking()).toBe(0);
// Moving along the edges with Shift held: still none.
const y = c.panes[n - 1].top;
expect(await cursorAt(page, x, y)).toBe("row-resize");
await page.waitForTimeout(300);
expect(await peeking()).toBe(0);
// Dragged with Shift still held: the edge follows, nothing peeks on the way or after.
const shown = c.panes.map((p, i) => (i < n - 1 ? c.panes[i + 1].top : c.bottom) - p.top);
await page.mouse.down();
await page.mouse.move(x, y + 100, { steps: 4 });
await page.waitForTimeout(250);
expect(await peeking()).toBe(0);
await page.mouse.move(x, y + 200, { steps: 4 });
await page.mouse.up();
await frames(page);
await page.waitForTimeout(250);
expect(await peeking()).toBe(0);
await page.keyboard.up("Shift");
c = (await measured(page))[1];
expect(c.sized).toBe(true);
expect(Math.abs(c.panes[n - 1].top - (y + 200))).toBeLessThanOrEqual(1.5);
expect(Math.abs(c.panes[n - 2].h - (shown[n - 2] + 200))).toBeLessThanOrEqual(1.5);
});
+4 -1
View File
@@ -349,7 +349,7 @@ test.describe("panes", () => {
// A Shift-click on a row opens it in place of the pane there.
await paneOf(page, "Tuning and temperament").locator(".row", { hasText: "The comma" }).click({ modifiers: ["Shift"] });
await expect.poll(() => trail(page)).toEqual(["Tuning and temperament", "The comma"]);
// Five panes in one column: a covered one peeks under the mouse; with room, a pane drags by its grip (the ⋯ beside it does not drag).
// Five panes in one column: a covered one peeks under the mouse with Shift held; with room, a pane drags by its grip (the ⋯ beside it does not drag).
await page.evaluate(() => localStorage.clear());
await open(page);
await keys(page, "z j Enter j Enter j Enter j Enter j Enter");
@@ -359,7 +359,10 @@ test.describe("panes", () => {
const covered = col.locator(":scope > .pane[data-covered]").first();
await expect(covered).toHaveCount(1);
await covered.locator(".tabline").hover();
await page.keyboard.down("Shift");
await expect(covered).toHaveAttribute("data-peek", "");
await page.keyboard.up("Shift");
await expect(covered).not.toHaveAttribute("data-peek", "");
await page.mouse.move(5, 500);
await page.setViewportSize({ width: 1920, height: 2000 });
await expect.poll(() => col.getAttribute("class")).not.toContain("crowded");
+98 -4
View File
@@ -2,7 +2,7 @@
* The panes view: a click anywhere in a pane makes it active and anywhere clears a
* selection; a column's panes stand in the order of their sources; every pane in a crowded column
* shows at least its tab, above or below; the active pane is never cut short by its share of a
* column; a pane cut off for any reason peeks out at its fullest, and one that already has all its
* column; a pane cut off for any reason peeks out at its fullest with Shift held, and one that already has all its
* column gives it beside the others' tabs does not peek; the curves
* keep to their sources and landing lines through every kind of layout change (curveFaults); the
* selection bar keeps clear of a tab; a dotted curve turns toward its source; Alt with h j k l moves
@@ -205,12 +205,102 @@ test("the active pane is never cut short by its share of a column: the others gi
await noFaults(page, "the active pane elsewhere");
});
test("a pane cut off for any reason peeks out at its fullest (whole, if it fits in its column), across and down, and the curves follow it: covered from below or above, by its share, by the column's foot, beside a pinned pane, and with its column covered", async ({ page }) => {
test("a pane made active in a column takes the height its text needs, up to the column less a tab for each other pane, and the others give way: by a click, by [ and ], and by a click on it while it peeks", async ({ page }) => {
await page.setViewportSize({ width: 1700, height: 1000 });
await library(page);
for (const t of ["The tides", "What a proof is", "Fixed points"]) await clickOpen(page, "Library", t);
const col = page.locator(".strip > .col").nth(1);
/** Each pane of the column: what shows of it (down to the pane after it, in a crowded column), what it needs, whether it is active, its marks. */
const shown = () =>
col.evaluate((c) => {
const ps = [...c.querySelectorAll<HTMLElement>(":scope > .pane")];
const cb = c.getBoundingClientRect();
return {
h: c.clientHeight,
ps: ps.map((p, i) => {
const r = p.getBoundingClientRect();
const next = c.classList.contains("crowded") ? (ps[i + 1]?.getBoundingClientRect().top ?? Infinity) : Infinity;
const sc = getComputedStyle(p.querySelector(".pane-scroll")!);
return {
t: p.querySelector(".pane-head h2")?.textContent?.trim() ?? "",
shown: Math.max(0, Math.min(r.bottom, cb.bottom, next) - Math.max(r.top, cb.top)),
need: p.querySelector<HTMLElement>(".pane-body")!.offsetHeight + parseFloat(sc.paddingTop) + parseFloat(sc.paddingBottom),
active: p.classList.contains("active"),
marks: ["data-tab", "data-covered", "data-buried", "data-peek"].filter((a) => p.hasAttribute(a)),
};
}),
};
});
/** The active pane has what it needs (or the cap), shows no tab and is not covered; the others have given way. */
const expectGrown = async (label: string, title: string, before: Awaited<ReturnType<typeof shown>>) => {
await still(page);
const now = await shown();
const i = now.ps.findIndex((p) => p.t === title);
const a = now.ps[i];
expect(a.active, `${label}: ${title} is active`).toBe(true);
const cap = now.h - (now.ps.length - 1) * TAB;
expect(a.shown, `${label}: ${title} shows what it needs, or the cap`).toBeGreaterThanOrEqual(Math.min(a.need, cap) - 2);
expect(a.marks, `${label}: ${title} has no tab or cover left`).toEqual([]);
expect(a.shown, `${label}: ${title} grew`).toBeGreaterThan(before.ps[i].shown + 50);
for (const [j, p] of now.ps.entries()) {
if (j === i) continue;
expect(p.shown, `${label}: ${p.t} gave way`).toBeLessThanOrEqual(Math.max(TAB, before.ps[j].shown) + 1);
expect(p.shown, `${label}: ${p.t} keeps its tab`).toBeGreaterThanOrEqual(TAB - 1);
}
expect(now.ps.reduce((s, p) => s + p.shown, 0), `${label}: the column is filled, nothing more`).toBeLessThanOrEqual(now.h + 1);
};
const library0 = async () => {
await pane(page, "Library").locator(".top h1").first().dispatchEvent("click");
await still(page);
await page.mouse.move(5, 990);
};
// The active pane elsewhere: the three share the column, each cut short.
await library0();
let before = await shown();
expect(before.ps.every((p) => p.shown < p.need - 50)).toBe(true);
// A click on the last one's head.
const titles = before.ps.map((p) => p.t);
const head = (t: string) => pane(page, t).locator(".pane-head h2");
await head(titles[2]).click();
await expectGrown("a click", titles[2], before);
// [ moves up the column: the one above it grows, the last gives way.
before = await shown();
await keys(page, "[");
await expectGrown("[", titles[1], before);
before = await shown();
await keys(page, "]");
await expectGrown("]", titles[2], before);
// From the shared column again, each in turn: a click on it while it peeks (Shift held, resting on it), the way a reader clicks a pane that has come out.
for (const t of titles) {
await library0();
before = await shown();
const at = await pane(page, t).evaluate((el) => {
const r = el.getBoundingClientRect();
return { x: r.left + 80, y: r.top + 60 };
});
await page.mouse.move(at.x, at.y);
await page.keyboard.down("Shift");
await expect(pane(page, t)).toHaveAttribute("data-peek", "");
const hb = (await head(t).boundingBox())!;
await page.mouse.click(hb.x + 5, hb.y + hb.height / 2);
await page.keyboard.up("Shift");
await expect(pane(page, t)).not.toHaveAttribute("data-peek", "");
await expectGrown(`a click while it peeks`, t, before);
}
});
test("a pane cut off for any reason peeks out at its fullest with Shift held (whole, if it fits in its column), across and down, and the curves follow it: covered from below or above, by its share, by the column's foot, beside a pinned pane, and with its column covered", async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 700 });
await library(page);
for (const t of ["Octopus minds", "Explicata", "The tides", "Fixed points"]) await clickOpen(page, "Library", t);
/** Hover each pane of the top-level trees' column that is cut off, and check it comes out whole, and the curves with it. */
/** Hover each pane of the top-level trees' column that is cut off, Shift held, and check it comes out whole, and the curves with it. */
const sweep = async (label: string, across: boolean) => {
await page.keyboard.down("Shift");
const peeked = await sweepHeld(label, across);
await page.keyboard.up("Shift");
return peeked;
};
const sweepHeld = async (label: string, across: boolean) => {
const col = page.locator(".strip > .col").nth(1);
const n = await col.locator(":scope > .pane").count();
let peeked = 0;
@@ -307,10 +397,11 @@ test("a pane that already has all its column can give it beside the others' tabs
return { t: p.querySelector(".pane-head h2, .top h1")?.textContent?.trim(), box: [r.left, r.top, r.width, r.height].map(Math.round), tab: p.hasAttribute("data-tab"), shows: !!hit && p.contains(hit), peek: p.hasAttribute("data-peek") };
});
}, TAB);
/** Rest the mouse on the pane at the column's foot, longer than it takes a pane to peek. */
/** Rest the mouse on the pane at the column's foot, Shift held, longer than it takes a pane to peek. */
const rest = async () => {
const b = (await pane(page, "The tides").boundingBox())!;
await page.mouse.move(b.x + 60, b.y + b.height / 2);
await page.keyboard.down("Shift");
await page.waitForTimeout(450);
};
/** With this pane active (The tides, or one deeper on its branch): The tides at the column's foot does not peek. */
@@ -329,6 +420,7 @@ test("a pane that already has all its column can give it beside the others' tabs
expect(after[3].box, `${label}: its box`).toEqual(before[3].box);
for (const p of after.slice(0, 3)) expect(p.shows, `${label}: ${p.t}'s tab`).toBe(true);
await noFaults(page, `${label}: resting on it`);
await page.keyboard.up("Shift");
await page.mouse.move(1910, 690);
};
await check("the column in full view", "The tides");
@@ -341,6 +433,7 @@ test("a pane that already has all its column can give it beside the others' tabs
await check("the column covered", "The brake");
// A folded pane peeking out of the covered column covers the tabs after it: the curves to and from those tabs are under it, the column's others over the column.
const fp = (await pane(page, "Fixed points").boundingBox())!;
await page.keyboard.down("Shift");
await page.mouse.move(fp.x + 60, fp.y + TAB / 2);
await page.waitForTimeout(450);
await expect(col).toHaveAttribute("data-peek", "");
@@ -358,6 +451,7 @@ test("a pane that already has all its column can give it beside the others' tabs
expect(peeked.y + peeked.height).toBeLessThanOrEqual(c.y + c.height + 1);
expect((await column())[0].shows, "Explicata's tab").toBe(true);
await page.mouse.move(1910, 690);
await page.keyboard.up("Shift");
await noFaults(page, "back");
});
+3
View File
@@ -65,6 +65,8 @@ test("peeking in a busy forest: every other curve leaves the peeking pane's plac
}),
);
expect(cut.length).toBeGreaterThan(1);
// Shift held, as the mouse comes onto each.
await page.keyboard.down("Shift");
for (const c of cut) {
await page.mouse.move(c.x, c.y);
await expect(page.locator(`.pane[data-tid="${c.tid}"]`)).toHaveAttribute("data-peek", "");
@@ -76,6 +78,7 @@ test("peeking in a busy forest: every other curve leaves the peeking pane's plac
await expect(page.locator(`.pane[data-tid="${c.tid}"]`)).not.toHaveAttribute("data-peek", "");
await noFaults(page, `after ${c.tid}`);
}
await page.keyboard.up("Shift");
});
test("a pane's title and its tab never show together, and the curve lands in whichever shows, as a crowded column scrolls through its panes", async ({ page }) => {