fix(spa): body margin + nav box-sizing resets (#373, #377) #378

Merged
timothy merged 1 commits from fix/373-377-spa-css-resets into main 2026-07-16 22:12:52 +02:00
3 changed files with 22 additions and 1 deletions
+6 -1
View File
@@ -25,7 +25,12 @@ Vite + React + TypeScript, builds to `ErsatzTV/wwwroot/app` (see `web/vite.confi
- **API clients**: `web/src/api/<domain>.ts` (see §4).
- **Styling**: `web/src/shell.css` (+ `web/src/components/components.css`) — utility classes with a
`ctv-` prefix (~690 occurrences across those two files). Reuse an existing `ctv-*` class before
inventing a new one.
inventing a new one. `shell.css` carries the only base reset — `html, body { margin: 0 }` plus
`body { background: var(--surface-app) }` (the 8px default body margin otherwise frames every
full-viewport layout with a light border, #373). **There is no global `box-sizing` reset**
(the SPA is authored under the default `content-box`), so any element that combines `width: 100%`
with padding/border must set `box-sizing: border-box` locally or it overflows its container — e.g.
`.ctv-nav-item` (#377). Prefer `width: auto` (shrink-to-fit) over `width: 100%` + padding where you can.
## 2. CRITICAL: sub-path screens must own their own pathname state
+5
View File
@@ -764,6 +764,11 @@
display: flex;
align-items: center;
gap: 10px;
/* The SPA ships no global box-sizing reset (default content-box), so width:100% + the
horizontal padding below would otherwise overflow .ctv-nav (overflow:auto) by 20px and
produce a horizontal scrollbar in the sidebar (#377). Border-box keeps the item exactly
the nav content width, padding included. */
box-sizing: border-box;
width: 100%;
height: 34px;
border: 0;
+11
View File
@@ -1,6 +1,17 @@
/* Base reset on <html>/<body>: the browser-default body margin (8px) frames every
full-viewport layout — the app shell AND the shell-less .ctv-auth-page boot pages, both
min-height:100vh — exposing a light border on all sides (#373). Strip it and paint the app
surface so any residual gap/overscroll stays dark. Matches the design-system convention
(design-system/components/forms/forms.card.html, .../chicorytv-admin/*.html). */
html,
body {
margin: 0;
}
/* Base typography on <body>: Dialog (and any overlay) portals into document.body, outside
.ctv-app-shell — without this, portaled UI falls back to the browser default font. */
body {
background: var(--surface-app);
font-family: var(--font-sans, system-ui, sans-serif);
font-size: var(--text-sm, 13px);
color: var(--text-primary, #f0ebe4);