diff --git a/docs/spa-conventions.md b/docs/spa-conventions.md index 050dcb6a2..0e306666b 100644 --- a/docs/spa-conventions.md +++ b/docs/spa-conventions.md @@ -25,7 +25,12 @@ Vite + React + TypeScript, builds to `ErsatzTV/wwwroot/app` (see `web/vite.confi - **API clients**: `web/src/api/.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 diff --git a/web/src/components/components.css b/web/src/components/components.css index 1e873457e..6db4b7183 100644 --- a/web/src/components/components.css +++ b/web/src/components/components.css @@ -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; diff --git a/web/src/shell.css b/web/src/shell.css index 1a9b7f06d..221358688 100644 --- a/web/src/shell.css +++ b/web/src/shell.css @@ -1,6 +1,17 @@ +/* Base reset on /: 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 : 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);