Skip to content

fix(site): address accessibility, performance, and responsive audit findings - #333

Merged
nicolasLuduena merged 2 commits into
feat/docs-sitefrom
site/audit
Nov 27, 2026
Merged

nicolasLuduena merged 2 commits into
feat/docs-sitefrom
site/audit

Conversation

@nicolasLuduena

@nicolasLuduena nicolasLuduena commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Stacked on #334: merge that first. Both are rebased onto the narrow-screen drawer in #307 (45a3053), which replaced the collapsible menus this PR originally fixed.

Summary

 site/
 ├── astro.config.ts                # register wrapTables rehype plugin
 ├── src/
 │   ├── components/
+│   │   └── Mermaid.astro          # diagram-only loader, role="img" label, <details> source
 │   ├── layouts/
 │   │   └── DocPage.astro          # self-hosted Inter preload, landmarks, copy labels
 │   ├── lib/
 │   │   ├── overflow.ts            # keyboard-focusable region only while overflowing
+│   │   └── wrap-tables.ts         # build-time <div class="table-wrap"> around <table>
 │   └── styles/
+│       ├── fonts.css              # self-hosted Inter + JetBrains Mono + Inter Fallback metrics
 │       └── site.css               # native table display, 200% text-zoom caps, touch targets, reduced motion

Audit Findings

Severity Category Finding Resolution
P1 Accessibility .prose table { display: block } strips native table semantics in WebKit/VoiceOver; overflowing containers were not keyboard-focusable Added build-time rehype plugin wrapTables (<div class="table-wrap">), restored native display: table; width: 100%, and made watchOverflow set tabindex="0" + role="region" only while content overflows horizontally
P1 Accessibility Mermaid replaced <pre> with an unlabeled SVG whose text nodes read in reversed/scattered DOM order and discarded the text source Extracted Mermaid.astro; wraps each diagram in <figure class="mermaid-figure">, hides SVG internals behind <div role="img" aria-label="...">, and preserves the original Mermaid source in a collapsed <details class="diagram-source">
P1 Performance Render-blocking third-party Google Fonts stylesheet (fonts.googleapis.com / fonts.gstatic.com, 3 external requests/page) Self-hosted @fontsource-variable/inter and @fontsource-variable/jetbrains-mono in fonts.css using the exact family names in tokens.css (left untouched), added 'Inter Fallback' metric overrides, and preloaded Latin Inter .woff2
P1 Performance details[data-menu] shipped open and collapsed in a deferred module script, causing severe CLS (0.525–0.694) on narrow viewports Superseded: the drawer in #307 is hidden by CSS from first paint, so there is no menu to collapse. CLS is 0 at 1440, 768 and 375 on / and /docs/DESIGN/ after the rebase
P1 Accessibility / Responsive Desktop TOC links (18px height, 22px center-to-center) failed WCAG 2.5.8 AA (24px), sidebar summaries were 17px, and coarse-pointer controls (17–43px) fell below 44px; code copy buttons lacked distinguishing labels Raised desktop TOC links to 24px (28px center-to-center) and sidebar summaries to 25px; raised every coarse-pointer interactive control (.wordmark, .repo, .menu-toggle, sidebar/TOC/diagram summaries and links, .code-block-copy, footer link) to >= 44px; added aria-label="Copy <lang> code" to copy buttons
P1 Responsive 200% text-only scaling (html { font-size: 200% } at 1280×800) overflowed horizontally to 2264px Changed .site-body tracks to minmax(0, min(var(--nav-width), 20vw)) minmax(0, var(--content-width)) minmax(0, min(var(--margin-width), 16vw)), matched .sidebar width cap, and used min-height on .site-header-inner
P2 Accessibility On mobile, .doc-meta <summary>On this page</summary> sat outside <nav> when collapsed; #copy-status sat outside any landmark Wrapped .doc-meta <details> inside <nav class="doc-meta" aria-label="On this page"> (matching Nav.astro) and moved #copy-status inside <main>
P2 Accessibility @media (prefers-reduced-motion: reduce) used a wildcard *, *::before, *::after { transition-duration: 0s !important } kill rule Replaced with targeted transition: none on the site's transitioned selectors plus html { scroll-behavior: auto }
P2 Performance Mermaid loader script (2.4 KB) shipped on all 18 pages even though only /docs/DESIGN/ has a diagram Moved the Mermaid script into Mermaid.astro and render it only when the page HTML contains data-language="mermaid"
— Performance (left as-is) Mermaid runtime loads 788 KB JS on /docs/DESIGN/ Left runtime rendering for diagram pages only; build-time rendering would require Chromium in GitHub Pages CI (.github/workflows/site.yml). Non-diagram pages load 0 B of Mermaid
— Brand / Parallel PR (left as-is) Inter & gradient h2 (3.91:1 at darkest #71717A stop, passes WCAG AA large text >= 3:1), dark-only theme, .prose th contrast (7.20:1), heading permalinks, prev/next links, external-link markers, home title Left untouched per pinned brand decisions (tokens.css untouched) and to avoid conflicts with the parallel visual-polish PR

Evidence

  • Before: Playwright against npx astro preview --port 4331 --host 127.0.0.1
    • Network (/): 10 requests, 3 external (Google Fonts), 6,436 B JS, desktop CLS 0.0203
    • Network (/docs/DESIGN/): 33 requests, 3 external, 903,519 B total
    • CLS (<= 78rem): tablet 768px 0.6852, zoom 640px 0.5607, mobile 375px 0.6939, reflow 320px 0.5987
    • Tables (/docs/DESIGN/): display: block on <table>, parent MAIN.content.prose, not keyboard-focusable when overflowing
    • Mermaid (/docs/DESIGN/): role="graphics-document document", no accessible name, ariaSnapshot read reversed/scattered SVG text ("Contract Attestor 3rd Party API Client..."), no text alternative
    • Targets: desktop 12 elements < 24px (sidebar summaries 17px, TOC links 18px); mobile coarse 20 elements < 44px + .code-block-copy 30px
    • 200% text-only zoom (1280×800): scrollWidth: 2264 (overflowX: true)
    • Landmarks: .doc-meta toggle and #copy-status outside landmarks
  • After: Playwright against rebuilt preview (npm run check --prefix site: 0 errors/warnings/hints; npm run build --prefix site: 18 pages built; biome ci .: 0 errors across 141 files)
    • Network (/): 7 requests, 0 external, 2,479 B JS (-61%), desktop CLS 0
    • Network (/docs/DESIGN/): 32 requests, 0 external, 814,487 B total (-89 KB)
    • CLS across all 15 page × viewport combinations (1440, 768, 640, 375, 320): 0 on every single run
    • Tables (/docs/DESIGN/): display: table inside build-time <div class="table-wrap">, full native table / rowgroup / row / columnheader / cell roles; overflowing mobile wire table exposes tabindex="0", role="region", aria-label="Scrollable table"
    • Mermaid (/docs/DESIGN/): ariaSnapshot exposes figure → img "Sequence diagram: Client, 3rd Party API, Attestor, Contract" + expandable group: Diagram source containing the complete Mermaid source
    • Targets: desktop 0 non-inline elements < 24px (TOC links 24px, sidebar summaries 25px); mobile coarse 0 elements < 44px (.code-block-copy 56×44px)
    • 200% text-only zoom (1280×800): scrollWidth: 1280 (overflowX: false)
    • Contrast: all measured UI and Shiki code tokens across all 18 pages pass WCAG AA (>= 5.54:1 normal text, >= 3.91:1 large gradient h2)
    • Landmarks: .doc-meta toggle inside <nav aria-label="On this page">, #copy-status inside <main>

No verification skill in this repo.

Merge Danger

Door: two-way

Static Astro site changes confined to site/; reverting the commit restores previous markup, styles, and font links cleanly with no persisted state or contract impact.

Blast Radius: low

Scoped strictly to site/ (documentation site only); does not touch site/src/styles/tokens.css, workspace packages, contracts, or repo Markdown docs.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 31c18954-1c12-4c0d-8e79-bae010a3f600

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

… and visual polish

Add visible # permalinks on h2 and h3 headings via a rehype plugin, previous/next navigation at the foot of each doc in nav order, and a north-east arrow marker on external prose links. Retitle the home page H1 to Introduction so the header wordmark and H1 do not repeat Thoth, raise table header size and contrast to 12px at --fg-2, style linked inline code chips as links, tighten heading bottom margins, mark the last TOC section at page bottom, and add copy-confirmation and touch-target refinements.
@nicolasLuduena
nicolasLuduena force-pushed the site/audit branch 2 times, most recently from 1cb7dfa to 28b9315 Compare November 27, 2026 22:41
@nicolasLuduena
nicolasLuduena changed the base branch from feat/docs-site to site/polish November 27, 2026 22:41
@nicolasLuduena
nicolasLuduena changed the base branch from site/polish to feat/docs-site November 27, 2026 22:43
@nicolasLuduena
nicolasLuduena merged commit 380cccb into feat/docs-site Nov 27, 2026
4 checks passed
@nicolasLuduena
nicolasLuduena deleted the site/audit branch November 27, 2026 22:43
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.

1 participant