ui: let a landscape poster fill a one-column card, and fix three scale-blind tests

`--card-poster-max-height` is a fixed height, so it stops scaling with the card: held to
220px, a 16:9 thumbnail is 391px wide, and any card wider than that centred it with empty
panel on both sides.  That is every video card at one column -- a phone, or any window
under about 456px of content width.

The cap is now `max(var(--card-poster-max-height), 56.25cqw)` with the poster band as the
query container.  56.25cqw is nine sixteenths of the card: exactly the height of a 16:9
image that fills the width, and the same number states the rule for every other ratio --
a poster may be as tall as a 16:9 slice of this card and no taller.  So a portrait book
cover still reads as a band rather than a column, and now grows with the card instead of
stopping at 220px.  `max()` rather than `min()` so the floor wins on a narrow card.

The gap pre-dated the interface scale, below about 414px, but the scale widened the range
it shows in: the track minimum went from 200px to 220px, so one column now starts at 456px
of content width instead of 414.

Every existing poster case mounted a 233px card, which is why the wide card's own failure
went unseen for the whole migration.  Two cases added on a 451px card: a landscape poster
reaches the edges, and a portrait cover stays a band.

Three tests carried a hardcoded px expectation, which is a hidden assertion that the
interface scale is 1.  All three failed at 1.1, in names that said nothing about size --
and I did not catch them because I ran jest and the build for the scale change but not
cypress, which AGENTS.md asks for on frontend work:

- `cardPosterCap()` read `--card-poster-max-height` with parseFloat.  The cap is rem now,
  so it returned 12.5 and failed a within(80, 240) bound -- taking five poster tests with
  it.  It resolves through the root font-size and checks the unit.
- `inNarrowColumn` was a fixed 340px, chosen to hold two 150px statistic tracks.  At 165px
  tracks it became one column, so a test about the gap BETWEEN columns had no second
  column.  It is now 340px times the scale, because "narrow" means narrow relative to the
  type.
- The APIButton size test asserted 36px for `small`.  It now measures against a real `sm`
  button, which is the claim it was making -- that `small` resolves to `sm` -- and holds at
  any scale.

A `uiScale()` helper reads the token so no further test has to name a pixel count.

Verified: ui-layout 248 passing, 0 failing; 1141 jest tests / 65 suites; clean build;
browser-checked at 400/451/500/700/1200px of grid width, no side gap at any of them.  The
12 remaining component failures are the pre-existing Semantic-era selector failures in
Tags, Channels, Download and Inventory.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-03 15:02:15 -06:00
parent dbc9f823a4
commit 7d602f7ea8
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 134 additions and 6 deletions

View file

@ -1291,6 +1291,12 @@ html[data-theme="amber"] .wrolpi-progress-fill {
.wrolpi-card-poster {
display: flex;
justify-content: center;
/*
* The band is the query container for the cap below, so the cap can be a fraction of the
* card's own width. Containment is safe here: the band's width comes from the card, never
* from the image inside it, and it has no fixed-position descendants.
*/
container-type: inline-size;
}
/*
@ -1346,7 +1352,24 @@ html[data-theme="amber"] .wrolpi-progress-fill {
width: auto;
height: auto;
max-width: 100%;
max-height: var(--card-poster-max-height);
/*
* The cap grows with the card, so a landscape poster can reach the card's edges.
*
* A fixed height stops scaling: held to 220px, a 16:9 thumbnail is 391px wide, so any card
* wider than that centred it with empty panel on both sides. That is every video card at
* one column -- a phone, or any window under about 456px of content -- which is where the
* whole library is browsed on a phone. The cases below all used a 233px card, so it went
* unseen for the entire migration.
*
* `56.25cqw` is nine sixteenths of the band: exactly the height of a 16:9 image that fills
* the width, and the same number states the rule for every other ratio -- a poster may be
* as tall as a 16:9 slice of this card and no taller. So a book cover still reads as a
* band rather than a column, and now grows with the card instead of stopping at 220px.
*
* `max()`, not `min()`: on a narrow card the fraction is the smaller value and the floor
* has to win, or the cap would tighten as cards got smaller and crop a portrait cover.
*/
max-height: max(var(--card-poster-max-height), 56.25cqw);
}
.wrolpi-card-icon {