Skip to content

fix(components): reach the subtle-system chart by keyboard and load its drawing lazily - #303

Merged
sydevs-bot merged 3 commits into
mainfrom
claude/fix-subtle-system-keyboard-and-weight
Nov 19, 2026
Merged

sydevs-bot merged 3 commits into
mainfrom
claude/fix-subtle-system-keyboard-and-weight

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Visitors on any page with rich text download about 316 KB less JavaScript (about 102 KB gzip). The subtle-system drawing (assets/chart.svg, ~325 KB of markup) used to ship in the shared RichText chunk on every page. It now loads in its own chunk, and only where a subtle-system block renders. The server HTML still has all 12 previews and their links. The drawing's box is held by an empty <svg> on the drawing's own viewBox, so nothing moves when the drawing arrives. If the chunk fails to load, the visitor loses only the picture, not the page.
  • Keyboard and screen-reader visitors can now use the chart. Each node that opens a preview is a named button (role="button", tabindex="0", aria-label from the item's title, aria-controls, aria-expanded). Focusing a node shows its preview. Enter or Space moves focus to the preview's "Learn more" link. Closed previews are inert, so they are not in the tab order or the accessibility tree. A focused node keeps a visible 2px ring whatever the pointer has selected. Pointer behaviour is unchanged.
  • For developers: the file-scoped dangerouslySetInnerHTML exemption in eslint.config.js now names SubtleSystemChart.tsx, and its comment says what that file injects: a bundled asset, not SahajCloud rich text. components/AGENTS.md lists SubtleSystem in the table of ClientOnly holes, and states what a visitor without JavaScript gets.

Findings addressed

  • F14a: the chart drawing shipped on every rich-text page. On main (5ee6ded), components/organisms/SubtleSystem/SubtleSystem.tsx:2 imported assets/chart.svg?raw statically, and blockConverters.tsx:28 imports SubtleSystem. So pnpm build put the drawing in chunk-BnOoyE0P.js (474.21 KB, 152.14 KB gzip), and every rich-text page entry imports that chunk statically. The drawing now lives in SubtleSystemChart.tsx, which is reached only through ClientOnly + React.lazy, inside its own Suspense and Sentry.ErrorBoundary. Each page's static client JS (its static-import closure), measured with pnpm build before and after this PR (raw / gzip):

    Entry Before After
    /[slug] 1001.5 / 328.4 KB 685.4 / 226.3 KB
    lectures/[id] full 997.1 / 326.3 KB 681.0 / 224.3 KB
    meditations/[id] full 997.2 / 326.3 KB 681.0 / 224.3 KB
    meditations embed 998.3 / 326.7 KB 682.2 / 224.7 KB
    lectures embed 993.0 / 324.2 KB 676.9 / 222.2 KB
    map, error, sentry, client-routing — unchanged

    The drawing is now a lazy chunk of 318.4 KB raw (101.7 KB gzip), and only an import() in the RichText chunk reaches it. dist/server without source maps went from 3,247,871 B to 2,914,670 B, and the drawing's path data has 0 hits there. In Chrome (Ladle), the placeholder and the real drawing measured the same size: 293.98×370.77 at 390px wide and 436.09×550 at 1280px.
    Pinned by SubtleSystem.test.tsx (node, server render): all 12 preview hrefs are present, the drawing is absent, and the placeholder's opening tag is exactly <svg aria-hidden="true" viewBox=…> with the viewBox read from assets/chart.svg. It also runs a source guard: only SubtleSystemChart.tsx imports chart.svg, nothing imports it statically, and SubtleSystem.tsx reaches it only through import('./SubtleSystemChart'). SubtleSystem.chunk-error.test.tsx (jsdom) makes the chunk's import reject. The previews and the box must stay. Without the boundary, the error escapes to the root and the test fails.

  • F8g: chart nodes were unreachable by keyboard. On main, SubtleSystem.tsx:225-229 bound only mouseover, mouseout and click on the SVG nodes. The nodes had no tabindex, no role and no name. The fix is described in the Summary. A few details:

    • Nodes with no item get no tab stop. Neither do nodes of the hidden view, including kundalini and chakra_7, which stay drawn in the channels view.
    • Focus opens the node's preview at once, skipping the 100 ms nested-hover delay.
    • An SVG element ignores a box-shadow, so the ring is a CSS outline. That rule also sets opacity: 1, because a node is drawn at opacity 0 unless it is .active, and an outline fades with its element.
    • onNodeSelect is called on every focus and every Enter, as it already is on every click. No caller passes it today.

    Pinned by SubtleSystem.keyboard.test.tsx. It runs in jsdom with the real ClientOnly and the real lazy module, and has 9 cases:

    1. Named button with tabindex, aria-controls and aria-expanded.
    2. No stop on a node with no item or on a hidden-view node.
    3. Focus opens only that preview.
    4. Enter moves focus to the link and prevents the default.
    5. Space does the same.
    6. Enter after a hover moved the selection.
    7. A listener bound before the pointer moved the selection still reports the selection.
    8. The stops move with the view.
    9. Hover and click still work.

    Against the unfixed component, cases 1-8 fail. Case 9 passes either way, as a regression guard. SubtleSystem.test.tsx also asserts that all 12 server-rendered previews are inert, and that the :focus-visible rule draws the ring at opacity 1 and comes after every other node-opacity rule.

  • Stale eslint.config.js comment (bundle item). The comment said SubtleSystem renders SahajCloud's rich text. It now says SubtleSystemChart injects assets/chart.svg, and the exemption moved to that file.

Not in this PR

  • No new visitor-facing string. Node names reuse each item's existing title, and the link keeps the existing blocks.a11y.learn_more_about and blocks.general.learn_more keys. No translation key is needed upstream.
  • Two review fixes landed after the Chrome check: the opacity: 1 on the focus rule and the error boundary. A stylesheet test and a jsdom test pin them. Neither was re-checked in a real browser.

Reconciled with open PRs

Test results

.claude/skills/pr-prep/check.sh --full at a2eaffc, exit 0:

  • Lint: 0 errors, 1084 warnings repo-wide. The lines this PR writes add no new warnings. The only warnings in touched files are pre-existing prettier ones on two union-type lines in SubtleSystem.tsx and in the untouched SubtleSystem.stories.tsx.
  • tsc --noEmit: passed.
  • Vitest: 132 files, 1235/1235 tests passed. The SubtleSystem files also passed in 5 back-to-back reruns (19/19 each).
  • pnpm build: passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw

SubtleSystem imported assets/chart.svg?raw statically, and the RichText
block converters import SubtleSystem, so the drawing's 325 KB of markup
(about 100 KB gzipped) rode the shared RichText chunk. Every page that
renders rich text downloaded it, whether or not it had a subtle-system
block.

The drawing now lives in SubtleSystemChart, reached only through
ClientOnly + React.lazy, so the browser fetches it only where the block
renders and vike strips it from the Worker. The previews and their 12
links still server-render. Until the drawing lands, an empty <svg> on the
drawing's own viewBox holds its box under the same CSS rule, so nothing
shifts.

Measured with `pnpm build` (static-import closure of each page entry):
/[slug] 1001.5 KB -> 685.3 KB raw, 328.4 KB -> 226.3 KB gzip, and the
same ~102 KB gzip off the lecture and meditation pages and both embeds.
The drawing is a 326 KB / 104 KB gzip lazy chunk; dist/server loses
333 KB.

The eslint file-scoped exemption for dangerouslySetInnerHTML moves to
SubtleSystemChart, and its reason now says what the file injects: a
bundled asset, not SahajCloud rich text. components/AGENTS.md lists the
new ClientOnly hole and what a visitor without JavaScript loses (the
picture, not a link).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The chart bound only mouseover, mouseout and click on its SVG nodes, and
gave them no tabindex and no role. A keyboard could not open a single
preview, and a screen reader found twelve unnamed shapes, so the twelve
article links behind the chart were reachable by pointer only.

Each node of the shown view that opens a preview is now a button: it
takes a tab stop, its accessible name is the preview's own title, and it
carries aria-controls and aria-expanded for that preview. Focus opens
the preview at once, because the nested-chakra delay only exists for a
pointer crossing overlapping shapes. Enter or Space moves focus onto the
preview's link. Without that, Tab would reach the next node first, open
its preview instead, and leave only the last node's link reachable.
A node with no published page, and a node the view hides, get no stop.
kundalini and chakra_7 stay drawn in the channels view but have no
handler there, so they also get no stop.

A closed preview is inert, so no keyboard or screen reader reaches it,
including during its fade-out, when `invisible` alone still let focus
land in it. Only a closing preview now transitions `visibility`. An
opening one is visible in the commit that opens it, so Enter can focus
its link even when the pointer had moved the selection elsewhere.
Nodes draw an outline on :focus-visible, since `focus-ring` draws a
box-shadow and an SVG element ignores box-shadow.

Pointer behaviour is unchanged. Verified in Chrome via Ladle at 390px
and 1280px: Tab focus shows the ring and opens the preview, and Enter
lands on "Learn more about ..." even after a hover moved the selection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The drawing now arrives through React.lazy, and nothing caught a rejected
import closer than the root Sentry boundary in LayoutRoot. A dropped
connection, or a hashed chunk a deploy removed, replaced the whole page with
ErrorFallback, previews and links included. A Sentry.ErrorBoundary inside the
ClientOnly now renders the same empty box instead, so a failed chunk costs
only the picture.

A chart node is drawn at opacity 0 unless it is .active, and an outline
fades with its element. A hover that moved .active to another node left the
focused node's ring invisible. The :focus-visible rule now restores opacity 1.

handleNodeFocus still gated onNodeSelect on the activeNode its closure held,
so a listener bound before the pointer moved the selection re-selected the
node without reporting it. It now reports every selection, as a click does.

Two comments and the components/AGENTS.md row described the change's
history; they now state the constraint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-design a2eaffc Commit Preview URL

Branch Preview URL
Nov 19 2026, 09:25 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web a2eaffc Commit Preview URL

Branch Preview URL
Nov 19 2026, 09:25 PM

@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit a9c1ee0 Nov 19, 2026
12 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-subtle-system-keyboard-and-weight branch November 19, 2026 23:53
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 19, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 19, 2026
main's #303 added a SubtleSystem row to the no-JavaScript table and raised
its counts to five/sixth. This branch rewrote the LocationSearch row in the
same place, because map-search makes it the component's first adopter.

Both rows are kept, with main's counts, which the five rows now match.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYHdujKUYuziQGJrot
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
One conflict, in the `dom-no-dangerously-set-innerhtml` override. Both sides
moved the subject it names: #303 split the SVG injection out into
`SubtleSystemChart.tsx`, and this branch deleted `lib/atlas-head.tsx` and
turned the head's JSON-LD sink into a string Unhead renders through vike's
`headHtmlEnd`. `SubtleSystemChart.tsx` is the one remaining
`dangerouslySetInnerHTML` in the tree, so the override lists it alone.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXtfncYqJccTNxDtv4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants