Skip to content

Fix Safari Reader view mangling the calculator#5

Merged
notadev99 merged 1 commit into
mainfrom
fix/safari-reader-view
Jul 24, 2026
Merged

Fix Safari Reader view mangling the calculator#5
notadev99 merged 1 commit into
mainfrom
fix/safari-reader-view

Conversation

@notadev99

Copy link
Copy Markdown
Owner

What

Safari offers Reader view on the demo page and, when it triggers, renders the interactive calculator as broken article content — schematic gears collapse into solid black blobs, control groups show as empty framed boxes, and a Reader overlay sits on top.

This does both things suggested in #2, lowest-risk first:

  1. Reduce Reader eligibility. packages/web/src/ui/app.ts — trimmed the masthead .intro paragraph from two sentences (~300 chars, with a <strong> emphasis run) down to one short line, so the page reads structurally more like a tool (controls + results as the bulk of the content) than an article dominated by prose. Removed the now-unused .masthead .intro strong CSS rule. This is heuristic and best-effort — there's no official meta tag to disable Reader.
  2. Make Reader degrade gracefully. packages/web/src/schematic.ts — the generated SVG relied entirely on app.css (.gear-node { fill: none; stroke: ...; }) for its fill/stroke. When Reader strips author CSS, SVG shapes fall back to their default fill (black), which is exactly the "black blob" gears reported in the issue. Added fill/stroke/stroke-width (and stroke-dasharray for idlers) as inline presentation attributes on the gear circles, the plate baseline <line>, and the label/tag <text> elements. These are pure fallback values — the existing CSS still overrides them whenever it loads normally.

Testing

  • pnpm --filter @involute/web test — all 35 tests pass, including a new schematic.test.ts case asserting every gear <circle> carries fill="none" and a stroke="#…" attribute, and the plate <line> carries an explicit stroke.
  • pnpm --filter @involute/web build — builds cleanly.

What this PR does not verify

There is no Safari available in this environment, so the actual Reader-view visual result is not verified by this PR. Someone needs to manually confirm the fix by opening https://notadev99.github.io/Involute/ in Safari and tapping the Reader icon in the address bar (or the aA menu) — both that Reader is no longer offered (or is less eagerly offered), and that if it is triggered, the schematic no longer renders as solid black blobs.

Closes #2


Generated by Claude Code

Safari's Reader heuristic was triggering on the long intro paragraph,
treating the page as an article. When it strips CSS, the schematic's
SVG circles lose fill:none (from .gear-node) and default to solid
black fill.

- Trim the masthead intro to a short line so the page reads as an
  interactive tool rather than article-shaped prose.
- Set fill/stroke as presentation attributes directly on the
  generated SVG shapes (gear circles, plate line, labels) so the
  schematic still outlines correctly even if author CSS is stripped.
- Add a schematic test asserting the fill="none"/stroke presentation
  attributes are present.

Safari Reader rendering itself still needs manual verification (see
PR description) — there's no automated way to test it here.

Closes #2
@notadev99
notadev99 force-pushed the fix/safari-reader-view branch from 06fe0ce to b6e9953 Compare July 24, 2026 02:21
@notadev99
notadev99 merged commit c5fbaac into main Jul 24, 2026
1 check passed
@notadev99
notadev99 deleted the fix/safari-reader-view branch July 24, 2026 02:25
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.

Safari Reader view mangles the app

1 participant