Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(website): make the left column one thing, so it can be aligned with the picture

Etienne Lescotde457e7493de
diff --git a/website/src/components/Recreation/index.tsx b/website/src/components/Recreation/index.tsx
index f2d83a219..7d963bd8b 100644
--- a/website/src/components/Recreation/index.tsx
+++ b/website/src/components/Recreation/index.tsx
@@ -178,21 +178,30 @@ export default function Recreation() {
} as React.CSSProperties
}
>
- {/* ═══ THE CAPTIONS ═══ The section's real copy. Above the gate they
- share one box and take turns; below it they stack. */}
- <div className={styles.captions}>
- {BEATS.map((b) => (
- <article key={b.id} className={styles.cap} data-cap={b.id}>
- <p className={styles.capKicker}>{b.kicker}</p>
- <h3 className={styles.capTitle}>{b.title}</h3>
- <p className={styles.capSub}>{b.sub}</p>
- </article>
- ))}
- </div>
+ {/* ═══ THE LEFT COLUMN ═══ The caption and the inspector, in one flow
+ so the pair can be balanced against the picture as a unit — nothing
+ can align two boxes that are positioned absolutely and
+ independently, which is what they were.
+
+ The panel lives here rather than inside `.scene` for that reason
+ alone, and carries its own aria-hidden: it is a drawing, while the
+ caption above it is the section's real copy and has to stay in the
+ accessibility tree. */}
+ <div className={styles.column}>
+ {/* ═══ THE CAPTIONS ═══ Above the gate they share one box and take
+ turns; below it they stack. */}
+ <div className={styles.captions}>
+ {BEATS.map((b) => (
+ <article key={b.id} className={styles.cap} data-cap={b.id}>
+ <p className={styles.capKicker}>{b.kicker}</p>
+ <h3 className={styles.capTitle}>{b.title}</h3>
+ <p className={styles.capSub}>{b.sub}</p>
+ </article>
+ ))}
+ </div>
- <div className={styles.scene} aria-hidden="true">
{/* ═══ THE INSPECTOR ═══ */}
- <div className={styles.panel}>
+ <div className={styles.panel} aria-hidden="true">
<header className={styles.panelHead}>
<h4 className={styles.panelTitle} data-pane="style">
{PANELS.background.title}
@@ -347,7 +356,9 @@ export default function Recreation() {
</div>
</div>
</div>
+ </div>
+ <div className={styles.scene} aria-hidden="true">
{/* ═══ THE TOOL PALETTE ═══ six tools, the app's own bar */}
<div className={styles.palette}>
<span
diff --git a/website/src/components/Recreation/styles.module.css b/website/src/components/Recreation/styles.module.css
index 257fb315b..b2b1d2a01 100644
--- a/website/src/components/Recreation/styles.module.css
+++ b/website/src/components/Recreation/styles.module.css
@@ -79,6 +79,16 @@
color: var(--ost-fg);
}
+/* On a short window the gutter is the first thing to give: at 1280x720 the
+ tallest pane — ten cursor packs and two sliders — was losing 21px off its
+ bottom to it. Halving it buys 28 and clears that, and 14px still reads as a
+ margin rather than as an edge. */
+@media (max-height: 780px) {
+ .stage {
+ --gut-v: 14px;
+ }
+}
+
/* ═══ THE BAND ═════════════════════════════════════════════════════════════
Nine viewports. The ride is paced against whatever this turns out to be, plus
one more viewport of overflow, so changing it re-paces the scene and breaks
@@ -194,13 +204,29 @@
/* ═══ THE CAPTIONS ═════════════════════════════════════════════════════════ */
-.captions {
+/* The left column: the caption and the inspector, balanced against the picture
+ as one thing. They were two absolutely positioned boxes with no relationship,
+ so the pair could only ever be aligned by accident — the caption sat at the
+ picture's top and the panel hung below it, and on a laptop the pair finished
+ 120px past the picture's bottom. In one flow the group has a height, and a
+ height is all it takes to centre it on the same line the picture is centred
+ on. */
+.column {
position: absolute;
left: 4.5vw;
- top: var(--cap-top);
- width: calc(var(--pnl-w) - 8px);
+ width: var(--pnl-w);
+ top: calc(var(--v-t) + var(--v-w) * 0.28125);
+ transform: translateY(-50%);
z-index: 11;
pointer-events: none;
+}
+
+.captions {
+ position: relative;
+ width: calc(var(--pnl-w) - 8px);
+ /* Its children are absolute and take turns, so the box has no height of its
+ own — and the flow above needs one. */
+ height: var(--cap-h);
/* Gated with the inspector, on the inspector's own threshold and the
inspector's own timing, so the title does not announce a panel that is not
there yet. The per-beat cross-fade inside carries on independently. */
@@ -275,27 +301,20 @@
/* ═══ THE INSPECTOR ════════════════════════════════════════════════════════ */
.panel {
- position: absolute;
- left: 4.5vw;
- /* Under the caption, capped by the footage, free to be shorter.
-
- It hangs from the caption's bottom rather than centring on the picture.
- Centred, it rose above the caption whenever the picture was tall relative
- to the panel's content — at 1383x904 the panel's top landed 55px inside
- the caption's last line. The ask was only ever that it shrink to its
- content and keep its horizontal placement; the vertical centring was mine
- to invent and mine to take back.
+ /* Under the caption, in the column's flow, free to be shorter than its slot.
- Two ceilings, whichever is lower: the footage's height, and the room left
- between here and the bottom gutter. min() over custom properties is the
- pattern postcss-calc drops, so the built sheet is checked for it. */
- top: calc(var(--cap-top) + var(--cap-h));
- width: var(--pnl-w);
+ The ceiling is the room the column has between the gutters once the
+ caption has taken its share — and NOT the footage's height, which is what
+ was originally asked for and which turns out to clip. On a 1289x904 laptop
+ the picture is 460px tall and the cursor pane needs 470, so that ceiling
+ cut the Smoothing slider off the bottom of the demo. A panel ten pixels
+ taller than the picture is a smaller price than a control missing from it,
+ and now that the pair is centred on the picture rather than hanging past
+ it, the difference reads as symmetry instead of overflow. */
+ position: relative;
+ width: 100%;
height: auto;
- max-height: min(
- calc(var(--v-w) * 0.5625),
- calc(100vh - var(--gut-v) - var(--cap-top) - var(--cap-h))
- );
+ max-height: calc(100vh - var(--nav) - var(--gut-v) * 2 - var(--cap-h));
overflow: hidden;
z-index: 12;
border: 1px solid var(--ost-border);
@@ -1647,9 +1666,19 @@
--pnl-w: calc(100vw - 2 * var(--gut));
}
+ /* The pair is not a pair here — the picture sits between them — so the
+ column steps out of the way and its two children place themselves, which
+ is what `display: contents` is for. */
+ .column {
+ display: contents;
+ }
+
.captions {
+ position: absolute;
left: var(--gut);
+ top: var(--cap-top);
width: calc(100vw - 2 * var(--gut));
+ z-index: 11;
}
.capTitle {
@@ -1660,6 +1689,8 @@
is undone here, along with the -50% that went with it. The ceiling is what
the floor has not taken: it closes as --tl opens. */
.panel {
+ position: absolute;
+ width: calc(100vw - 2 * var(--gut));
left: var(--gut);
top: calc(var(--cell-top1) + var(--vw1) * 0.5625 + 14px);
max-height: calc(
@@ -1710,6 +1741,10 @@
height: auto;
}
+ .column {
+ display: contents;
+ }
+
.stage {
position: static;
height: auto;
@@ -1739,12 +1774,17 @@
height: auto;
}
+ .column {
+ display: contents;
+ }
+
.stage {
position: static;
height: auto;
}
- .scene {
+ .scene,
+ .panel {
display: none;
}
@@ -1765,7 +1805,8 @@
}
@media (forced-colors: active) {
- .scene {
+ .scene,
+ .panel {
display: none;
}
}