ui: scale the whole interface by 10%, off the root font-size

The interface reads about 10% smaller than the pre-migration Semantic build, and the
drift is not one number.  Measured on the QA Pi at 1280px, Semantic's headings were
h1 28 / h2 24 / h3 18 / h4 15 / h5 14 against our 26 / 21 / 17 / 14 / 13, and its video
card a fixed 290px with an 18px title against our 238px with a 13px one -- while our
BODY text and chrome went the other way, a 16px base against Semantic's 14 and 42px
buttons against 36.  No per-component nudge reproduces what a user comparing the two
sees, which is the whole page at once.

Ten percent is not a fudge factor: our heading scale times 1.1 is 28.6 / 23.1 / 18.7 /
15.4 / 14.3, which is Semantic's scale to within a pixel at every step.  Verified in
the browser -- those are the numbers it now renders.

`--ui-scale: 1.1` and `html { font-size: calc(100% * var(--ui-scale)) }`, with
everything that should grow written in rem:

- 102 lengths in ui.css, App.css and tokens.css converted, restricted by property:
  font-size, padding, margin, gap, width/height, border-radius, offsets.
- Borders, outlines and shadows deliberately NOT converted.  A hairline is a hairline
  at any text size.
- 46 inline `fontSize` px values across 8 files.  `em` values were left alone: they
  already resolve against the parent.
- Ten inline-styled blocks in the library (Card's text block, Loading, Placeholder,
  ColoredInput, Confirm's action row, CardGroup's gap) moved into ui.css, because an
  inline px size cannot be reached by a scale or seen by a test.
- CardGroup converts its `minWidth` prop to rem, which is what returns a phone to one
  card per row: as px the track ignored the scale, so a 430px screen fitted two 200px
  cards where the old build fitted one 290px card.

Mantine needs nothing: its 644 size declarations are `calc(Xrem * var(--mantine-scale))`
and scale with the root.  `theme.scale` must stay at 1 -- it exists to CANCEL a
customised root font-size, so setting it to 1.1 as well would leave Mantine's half of
the interface at the old size beside our larger text.  A test pins that.

`zoom: 1.1` on the root was tried first and rejected.  It works and it is one line, but
it scales at paint: every 1px hairline becomes 1.1px and softens on a 1x display, and
viewport units do not shrink to compensate, so `100vh` paints 110% of the screen -- a
95vw modal overflowed sideways and the CBZ viewer's fullscreen overflowed down.  Rem
scales real lengths, keeps borders crisp, leaves viewport units alone, and preserves a
user's own browser font-size preference instead of overriding it.

A percentage rather than a px root size, for that last reason.

Five guards in themes/ui-scale.test.js, each planted against: the scale itself, that
every scalable declaration is rem, that borders are NOT, that no inline px font-size
survives anywhere including the gallery, and that Mantine's scale stays 1.

Also removes `.ui.modal.themed-confirm`, a dead Semantic-era rule and the source of the
one `95vw` that would have overflowed: `.ui.modal` no longer exists and nothing sets
that class.

Verified: 1141 tests / 65 suites; clean build; browser-checked at 1280px and at a 430px
phone; navbar single-row from 780 to 1800px; hairlines still 1px and no horizontal
overflow in all four themes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-03 14:45:08 -06:00 • committed by lrnselfreliance
parent 05b1c75310
commit f4303476cf
17 changed files with 501 additions and 196 deletions

View file

@ -903,6 +903,12 @@ describe('Card', () => {
* card read buttons-then-domain. Which slot lands where is what this asserts; that
* the foot anchoring actually resolves is in ui-layout.cy.js, since `margin-top:
* auto` needs a layout engine.
*
* That division is why there is no `margin-top: auto` assertion here any more. There
* was one, reading the inline style, and it broke when the card's sizes moved into
* ui.css so the interface scale could reach them -- jsdom applies no stylesheet. It
* was asserting where the declaration was written rather than what it did, and the
* cypress test above measures the actual foot alignment either way.
*/
renderUI(<Card title='Rainwater Harvesting'
meta='engineering775.com'
@ -914,8 +920,8 @@ describe('Card', () => {
expect([...body.children].map(child => child.textContent)).toEqual([
'Rainwater Harvesting', 'engineering775.com', 'body', 'Details',
]);
expect(body.querySelector('.wrolpi-card-actions')).toHaveStyle({marginTop: 'auto'});
expect(body.querySelector('.wrolpi-card-meta').style.marginTop).toBe('');
expect(body.querySelector('.wrolpi-card-actions')).not.toBeNull();
expect(body.querySelector('.wrolpi-card-meta')).not.toBeNull();
});
it('renders no actions row when a card has no actions', () => {
@ -940,14 +946,20 @@ describe('CardGroup', () => {
expect(screen.getByText('Three')).toBeInTheDocument();
});
it('lays cards out on a track no narrower than minWidth', () => {
// The default suits file results; a group of wide cards raises it. If the value were
// dropped the grid would fall back to one column, which is how a card wall becomes a
// list on a desktop.
it('lays cards out on a track no narrower than minWidth, in rem so it scales', () => {
/*
* The default suits file results; a group of wide cards raises it. If the value were
* dropped the grid would fall back to one column, which is how a card wall becomes a
* list on a desktop.
*
* The px the caller names is converted to rem, which is the whole reason a phone shows
* one card per row again: as px, the track ignored the interface scale, and a 430px
* screen fitted two 200px cards where the pre-migration build fitted one 290px card.
*/
const {container} = renderUI(<CardGroup minWidth={320}><Card title='One'/></CardGroup>);
expect(container.querySelector('.wrolpi-card-group'))
.toHaveStyle({gridTemplateColumns: 'repeat(auto-fill, minmax(320px, 1fr))'});
.toHaveStyle({gridTemplateColumns: 'repeat(auto-fill, minmax(20rem, 1fr))'});
});
});