Skip to content

hub-client: theme the changelog/more-info iframe to match app dark mode - #626

Merged
shikokuchuo merged 2 commits into
mainfrom
fix-624-changelog-dark-mode
Aug 27, 2026
Merged

hub-client: theme the changelog/more-info iframe to match app dark mode#626
shikokuchuo merged 2 commits into
mainfrom
fix-624-changelog-dark-mode

Conversation

@shikokuchuo

Copy link
Copy Markdown
Member

Closes #624.

Root cause

The About tab renders changelog.md and more-info.md through the WASM pipeline into a sandboxed iframe. That iframe document is a separate browsing context: it sees none of the app's theme classes or CSS variables, its canvas lets the modal's --bg-modal show through, and the injected stylesheet hardcoded light colors (#333 text, no background). On the dark modal (#213D4F) that is 1.3:1 contrast — the changelog was near-invisible in dark mode.

Fix

  • New hub-client/src/utils/changelogDoc.ts: builds light and dark variants of the injected stylesheet from the theme.css palette (every text/background pair meets WCAG AA 4.5:1, pinned by contrast tests), declares color-scheme so UA painting (scrollbars) follows, and sets the body background to the modal color so the iframe blends seamlessly.
  • AboutTab.tsx now keeps the raw WASM renders and re-injects theme-matched styles from useTheme().effectiveTheme, so a theme flip restyles an already-rendered document without re-running the pipeline.
  • Also switches the light-theme link color from off-palette #646cff (4.09:1, AA fail) to the app's own --accent-secondary #447099 (5.22:1).

Tests

  • 9 unit tests (changelogDoc.test.ts) pinning WCAG AA contrast for text/links/code chips against each theme's modal background, plus injection behavior — written failing-first per TDD.
  • 2 component tests (AboutTab.test.tsx) with mocked WASM: dark app theme → iframe srcdoc gets dark styles; light → light. Existing shortcuts test now wraps in ThemeProvider.

Verification

  • 1060/1060 hub-client unit tests, 133/133 wasm tests, npm run build:all clean.
  • End-to-end in Chromium (Playwright): the real WASM-rendered changelog + real theme.css screenshotted in both themes — dark probe reports #fff text on rgb(33, 61, 79) with color-scheme: dark; light unchanged. Before/after screenshots inspected; dark mode went from illegible to fully readable.

Full cargo xtask verify was skipped at the request of the reviewer (hub-client-only change; no Rust crates touched).

@posit-snyk-bot

posit-snyk-bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@shikokuchuo
shikokuchuo force-pushed the fix-624-changelog-dark-mode branch 2 times, most recently from 1b6a7b9 to cc6ecfe Compare August 27, 2026 22:31
…de (GH #624)

The About tab renders changelog.md and more-info.md through the WASM
pipeline into a sandboxed iframe. That document is a separate browsing
context: it sees none of the app's theme classes or CSS variables, its
canvas lets the modal's --bg-modal show through, and the injected
stylesheet hardcoded light colors (#333 text). On the dark modal that
is 1.3:1 contrast — the changelog was near-invisible.

Extract the injected stylesheet into utils/changelogDoc.ts with light
and dark variants built from the theme.css palette (every text/
background pair meets WCAG AA 4.5:1, pinned by contrast tests), declare
color-scheme so UA painting follows, and set the body background to the
modal color so the iframe blends seamlessly. AboutTab now keeps the raw
WASM renders and re-injects theme-matched styles from
useTheme().effectiveTheme, so a theme flip restyles an open document
without re-running the pipeline.

Also switches the light-theme link color from off-palette #646cff
(4.09:1, AA fail) to the app's own --accent-secondary #447099 (5.22:1).

Verified end-to-end in Chromium (Playwright): real WASM-rendered
changelog + real theme.css screenshotted in both themes; dark probe
reports #fff text on #213D4F with color-scheme: dark.
@shikokuchuo
shikokuchuo force-pushed the fix-624-changelog-dark-mode branch from cc6ecfe to 8e3afb5 Compare August 27, 2026 22:43
@shikokuchuo
shikokuchuo merged commit 2af8791 into main Aug 27, 2026
10 checks passed
@shikokuchuo
shikokuchuo deleted the fix-624-changelog-dark-mode branch August 27, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hub-client: changelog theme is too dim in dark mode under new CSS

2 participants