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
parent a30a1110e1
commit b9b75e04f6
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
17 changed files with 501 additions and 196 deletions

View file

@ -36,7 +36,7 @@
* switch to `bottom-right` should not silently inherit a top offset.
*/
html .mantine-Notifications-root[data-position^='top'] {
top: calc(var(--navbar-height) + var(--mantine-spacing-md, 16px));
top: calc(var(--navbar-height) + var(--mantine-spacing-md, 1rem));
}
.wrolpi-navbar-right {
@ -159,7 +159,7 @@ html .wrolpi-navbar .mantine-ActionIcon-root:hover {
}
.channel-edit {
border-radius: 3px;
border-radius: 0.1875rem;
padding: 0.75em;
}
@ -186,12 +186,12 @@ pre.wrap-text {
.duration-overlay {
position: absolute;
top: 4px;
right: 4px;
top: 0.25rem;
right: 0.25rem;
color: black;
background: #ffffff;
padding: 0px 4px;
border-radius: 3px;
padding: 0px 0.25rem;
border-radius: 0.1875rem;
}
.no-link-underscore {
@ -219,8 +219,8 @@ div.inverted {
.toggle {
position: relative;
display: inline-block;
width: 49px;
height: 23px;
width: 3.0625rem;
height: 1.4375rem;
}
.toggle input {
@ -239,14 +239,14 @@ div.inverted {
background-color: rgb(166, 166, 166);
-webkit-transition: .4s;
transition: .4s;
border-radius: 34px;
border-radius: 2.125rem;
}
.slider:before {
position: absolute;
content: "";
height: 22px;
width: 22px;
height: 1.375rem;
width: 1.375rem;
left: 0;
bottom: 0;
background-color: white;
@ -316,9 +316,9 @@ input:checked + .slider:before {
Use 100dvh so mobile browser chrome (URL bar) is accounted for. */
.preview-fit {
width: 100%;
height: calc(100dvh - 300px);
max-height: calc(100dvh - 300px);
min-height: 240px;
height: calc(100dvh - 18.75rem);
max-height: calc(100dvh - 18.75rem);
min-height: 15rem;
overflow: hidden;
position: relative;
display: flex;
@ -356,12 +356,12 @@ td.file-path > svg {
.ui-alerts {
position: fixed;
z-index: 2060;
padding: 24px;
padding: 1.5rem;
}
.ui-alerts.top-right {
top: 20px;
right: 20px;
top: 1.25rem;
right: 1.25rem;
}
textarea.otp {
@ -370,9 +370,9 @@ textarea.otp {
}
.card-icon {
min-height: 163px;
min-height: 10.1875rem;
text-align: center;
padding-top: 53px;
padding-top: 3.3125rem;
}
.card-icon.inverted {
@ -426,11 +426,6 @@ textarea.otp {
box-shadow: none !important;
}
/* Mobile-responsive Confirm modal */
.ui.modal.themed-confirm {
max-width: 95vw;
}
.clickable {
cursor: pointer;
}
@ -469,7 +464,7 @@ textarea.otp {
}
.search-clear {
margin: 10px;
margin: 0.625rem;
}
.icon.divider {
@ -524,40 +519,40 @@ table.ratio-table td.min-width {
}
.form-skeleton-label {
height: 14px;
width: 80px;
margin-bottom: 8px;
height: 0.875rem;
width: 5rem;
margin-bottom: 0.5rem;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
border-radius: 3px;
border-radius: 0.1875rem;
}
.form-skeleton-input {
height: 38px;
height: 2.375rem;
width: 100%;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
border-radius: 4px;
border-radius: 0.25rem;
}
.form-skeleton-textarea {
height: 80px;
height: 5rem;
width: 100%;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
border-radius: 4px;
border-radius: 0.25rem;
}
.form-skeleton-button {
height: 42px;
width: 100px;
height: 2.625rem;
width: 6.25rem;
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s infinite;
border-radius: 4px;
border-radius: 0.25rem;
}
@keyframes skeleton-shimmer {
@ -741,7 +736,7 @@ tr.drag-deselecting td {
.inventory-print th,
.inventory-print td {
border: 1px solid #999;
padding: 4px 6px;
padding: 0.25rem 0.375rem;
text-align: left;
vertical-align: top;
}