Fix Safari Reader view mangling the calculator#5
Merged
Conversation
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
force-pushed
the
fix/safari-reader-view
branch
from
July 24, 2026 02:21
06fe0ce to
b6e9953
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
packages/web/src/ui/app.ts— trimmed the masthead.introparagraph 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 strongCSS rule. This is heuristic and best-effort — there's no official meta tag to disable Reader.packages/web/src/schematic.ts— the generated SVG relied entirely onapp.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. Addedfill/stroke/stroke-width(andstroke-dasharrayfor 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 newschematic.test.tscase asserting every gear<circle>carriesfill="none"and astroke="#…"attribute, and the plate<line>carries an explicitstroke.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