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
Owner

Fixes #373. Fixes #377.

Two missing-base-reset CSS defects in the ChicoryTV SPA shell — same file family, both confirmed by rendering the real running app (headless Playwright), not source-reading.

#373 — white border on the login / boot pages (and, per the reporter, all pages)

The browser-default body { margin: 8px } was never reset. It framed every full-viewport layout — the app shell and the shell-less .ctv-auth-page boot pages (login/setup/checking/error), both min-height:100vh — with a light border on all four edges. Root cause confirmed: getComputedStyle(document.body).margin === "8px", body/html background transparent.

Fix: html, body { margin: 0 } + paint body { background: var(--surface-app) } so any residual gap/overscroll stays dark. Matches the design-system reset (design-system/components/forms/forms.card.html, .../chicorytv-admin/*.html).

#377 — sidebar scrolls horizontally

The SPA ships no global box-sizing reset (default content-box), so .ctv-nav-item { width:100%; padding:0 10px } overflowed .ctv-nav (overflow:auto) by 20px → a horizontal scrollbar in the sidebar. Root cause confirmed: navScrollWidth 236 > navClientWidth 216, item box-sizing: content-box, offsetWidth 220.

Fix: scope box-sizing: border-box to .ctv-nav-item (root-cause, zero blast radius — the item now fits the nav content width exactly). Deliberately not a global * { box-sizing } reset: the whole SPA is authored under content-box, so a global switch is a broad regression risk unjustified for a low-priority cosmetic fix. Documented in spa-conventions.md so the next author sets border-box locally instead.

Verification (real render, warm theme, 1280px + 900px)

before after
body margin 8px 0px
boot-page / shell edge border light frame all sides none (dark to edge)
sidebar nav h-scroll scrollW 236 > clientW 216 (scrollbar) 216 == 216, none
nav-item box-sizing content-box (offsetW 220) border-box (offsetW 200)
page h-scroll @900px — none

Nav vertical scroll (intended) and label ellipsis unaffected. npm run lint clean, 780 vitest tests pass, npm run build green.

Docs

docs/spa-conventions.md §1 (Styling) now records the base reset and the deliberate absence of a global box-sizing reset.

Review note

Pure-SPA/CSS leaf, no server-state effect → live-E2E not required (rendered anyway to satisfy the issues' "render, don't source-read" Done-when). A cold-context adversarial review over this diff follows to satisfy the "adversarial review passed" box.

🤖 Generated with Claude Code

Fixes #373. Fixes #377. Two missing-base-reset CSS defects in the ChicoryTV SPA shell — same file family, both **confirmed by rendering the real running app** (headless Playwright), not source-reading. ## #373 — white border on the login / boot pages (and, per the reporter, all pages) The browser-default `body { margin: 8px }` was never reset. It framed every full-viewport layout — the app shell **and** the shell-less `.ctv-auth-page` boot pages (login/setup/checking/error), both `min-height:100vh` — with a light border on all four edges. Root cause confirmed: `getComputedStyle(document.body).margin === "8px"`, `body`/`html` background transparent. **Fix:** `html, body { margin: 0 }` + paint `body { background: var(--surface-app) }` so any residual gap/overscroll stays dark. Matches the design-system reset (`design-system/components/forms/forms.card.html`, `.../chicorytv-admin/*.html`). ## #377 — sidebar scrolls horizontally The SPA ships **no** global `box-sizing` reset (default `content-box`), so `.ctv-nav-item { width:100%; padding:0 10px }` overflowed `.ctv-nav` (`overflow:auto`) by 20px → a horizontal scrollbar in the sidebar. Root cause confirmed: `navScrollWidth 236 > navClientWidth 216`, item `box-sizing: content-box`, `offsetWidth 220`. **Fix:** scope `box-sizing: border-box` to `.ctv-nav-item` (root-cause, zero blast radius — the item now fits the nav content width exactly). Deliberately **not** a global `* { box-sizing }` reset: the whole SPA is authored under content-box, so a global switch is a broad regression risk unjustified for a low-priority cosmetic fix. Documented in spa-conventions.md so the next author sets border-box locally instead. ## Verification (real render, warm theme, 1280px + 900px) | | before | after | |---|---|---| | `body` margin | `8px` | `0px` | | boot-page / shell edge border | light frame all sides | none (dark to edge) | | sidebar nav h-scroll | `scrollW 236 > clientW 216` (scrollbar) | `216 == 216`, none | | nav-item box-sizing | content-box (offsetW 220) | border-box (offsetW 200) | | page h-scroll @900px | — | none | Nav vertical scroll (intended) and label ellipsis unaffected. `npm run lint` clean, **780 vitest tests pass**, `npm run build` green. ## Docs `docs/spa-conventions.md` §1 (Styling) now records the base reset and the deliberate absence of a global box-sizing reset. ## Review note Pure-SPA/CSS leaf, no server-state effect → live-E2E not required (rendered anyway to satisfy the issues' "render, don't source-read" Done-when). A cold-context adversarial review over this diff follows to satisfy the "adversarial review passed" box. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timothy added 1 commit 2026-07-16 21:58:00 +02:00
fix(spa): add body margin + nav box-sizing resets (fixes #373, fixes #377)
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 9s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 10s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 16s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 16s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 4m41s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 6m18s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 6m4s
1575b9b537
Two missing-base-reset defects in the ChicoryTV SPA shell, both confirmed by
rendering the real app (not source-reading):

- #373: the browser-default `body { margin: 8px }` was never reset, so it framed
  every full-viewport layout — the app shell and the shell-less `.ctv-auth-page`
  boot pages (login/setup/checking/error), both `min-height:100vh` — with a light
  border on all four edges. Fix: `html, body { margin: 0 }` + paint the app surface
  on `body` so any residual gap/overscroll stays dark (matches the design-system
  reset in forms.card.html / chicorytv-admin templates). Verified body margin 0 and
  no edge border on the boot page and the shell, warm theme, 1280px and 900px.

- #377: the SPA ships no global `box-sizing` reset (default content-box), so
  `.ctv-nav-item { width:100%; padding:0 10px }` overflowed `.ctv-nav`
  (`overflow:auto`) by 20px → a horizontal scrollbar in the sidebar. Fix: scope
  `box-sizing: border-box` to `.ctv-nav-item`. Verified nav scrollWidth==clientWidth
  (216==216) and no horizontal scroll after the fix; the intended vertical nav scroll
  is unaffected.

Docs: spa-conventions.md §1 records the base reset and the deliberate absence of a
global box-sizing reset (set border-box locally when combining width:100% + padding).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
Owner

Cold-context adversarial review (review-only agent, fresh context) over the full diff — all five risk angles traced to source, no defects:

  1. Portaled overlays — the only body portal is overlay.tsx; its .ctv-dialog-overlay backdrop is position:fixed; inset:0; z-index:100; rgba(0,0,0,.55) painted over everything → body background sits strictly behind it, cannot alter it.
  2. --surface-app defined before paint — declared unconditionally at :root (design-system/tokens/colors.css:44), imported before shell.css; no theme/JS gate. Undefined-case fallback is transparent = the exact pre-fix state (non-regression).
  3. Box-sizing scope sufficient — .ctv-nav-item is the only width:100%+padding element inside .ctv-nav (the sole overflow:auto scroller); .ctv-nav-section is width:auto (fits), health/brand rows are outside .ctv-nav. border:0 means height is unchanged.
  4. html,body{margin:0} — standard reset, nothing depended on the 8px.
  5. Theme coverage — --surface-app is dark in warm (#12100E) and cool/dual (#0F1115); both artifacts are theme-independent geometry, so warm-only render is adequate.

Review-verdict: MERGEABLE @ 1575b9b537

Cold-context adversarial review (review-only agent, fresh context) over the full diff — all five risk angles traced to source, no defects: 1. **Portaled overlays** — the only body portal is `overlay.tsx`; its `.ctv-dialog-overlay` backdrop is `position:fixed; inset:0; z-index:100; rgba(0,0,0,.55)` painted *over* everything → body background sits strictly behind it, cannot alter it. 2. **`--surface-app` defined before paint** — declared unconditionally at `:root` (`design-system/tokens/colors.css:44`), imported before `shell.css`; no theme/JS gate. Undefined-case fallback is `transparent` = the exact pre-fix state (non-regression). 3. **Box-sizing scope sufficient** — `.ctv-nav-item` is the only `width:100%`+padding element inside `.ctv-nav` (the sole `overflow:auto` scroller); `.ctv-nav-section` is `width:auto` (fits), health/brand rows are outside `.ctv-nav`. `border:0` means height is unchanged. 4. **`html,body{margin:0}`** — standard reset, nothing depended on the 8px. 5. **Theme coverage** — `--surface-app` is dark in warm (`#12100E`) and cool/dual (`#0F1115`); both artifacts are theme-independent geometry, so warm-only render is adequate. Review-verdict: MERGEABLE @ 1575b9b53788d624eebb8acea15481420c5a69ee
timothy merged commit b17a70be1b into main 2026-07-16 22:12:52 +02:00
timothy deleted branch fix/373-377-spa-css-resets 2026-07-16 22:12:53 +02:00
Sign in to join this conversation.