5 Commits

Author SHA1 Message Date
Farhan Asghar
a9039df6de a11y(shared): make subscribe modal a real dialog for keyboard and screen-reader users (#1948)
The subscribe modal (shared across the book, site, labs, kits, and
mlsysim subsites) was a plain div overlay:

- No role="dialog", aria-modal, or accessible name, so screen readers
  never announced it as a dialog and could wander into the page
  behind the overlay.
- No focus trap: Tab walked out of the modal into the visually hidden
  background page.
- Focus was never returned to the triggering element on close, dropping
  keyboard users at the top of the document.
- Open/close animations played regardless of prefers-reduced-motion.

Changes to the canonical shared/scripts/subscribe-modal.js:

- role="dialog" aria-modal="true" aria-labelledby on the container,
  with an id on the existing title.
- Tab/Shift+Tab now cycle within the modal's visible, enabled controls
  (computed per keypress, so the trap also works on the post-submit
  success view).
- The opener element is saved on openModal() and refocused on close.
- Animations are disabled under prefers-reduced-motion: reduce.

Mirrors regenerated with shared/scripts/sync-mirrors.sh (CI drift
check). Escape-to-close and overlay-click behavior unchanged.
2026-07-15 11:47:26 +02:00
Vijay Janapa Reddi
c07b37eca6 fix(site): open subscribe modal from navbar CTA 2026-06-24 11:55:00 -04:00
Vijay Janapa Reddi
edbea966bf refactor(tinytorch): rename site-quarto/ to quarto/
Brings the TinyTorch lab guide's Quarto project in line with
book/quarto/, the only other in-tree Quarto publication that builds
both web and PDF outputs from a single source. The previous name had
three redundancies:

  - already under tinytorch/, so "site-" prefix wasn't disambiguating
  - also produces the PDF lab guide, so "site-" was misleading
  - the top-level site/ dir made "site-quarto" read as "the site's
    quarto config" rather than "the tinytorch site, in quarto"

After this rename the convention is straightforward:

  book/quarto/        -> the textbook (web + PDF)
  tinytorch/quarto/   -> the TinyTorch lab guide (web + PDF)
  mlsysim/docs/       -> mlsysim API reference (kept as docs/, since it
                        really is API reference, not a publication)

Touches 7 GitHub workflows, both .gitignore files, the rename target's
own self-references (Makefile, _quarto.yml configs, STYLE.md,
measure-pdf-images.py), and 6 copies of subscribe-modal.js plus a few
shared scripts/configs whose comments documented the old path.

Verified: rebuilt pdf/TinyTorch-Guide.pdf (2.1M) cleanly from the new
location with 'make pdf' from tinytorch/quarto/.
2026-04-22 14:38:18 -04:00
Vijay Janapa Reddi
2190968942 refactor: deduplicate subscribe-modal + socratiQ via mirror sync script
Quarto's resource-copy step preserves symlinks rather than dereferencing
them, which breaks both local builds (AlreadyExists on the second pass)
and gh-pages deploys (relative symlink targets fall outside _build/).
And Sass resolves @import relative to the importing file's physical
location, not the symlink target. So symlinks inside the resource path
are not a viable dedup mechanism.

Instead, keep real file copies in each consumer subsite and enforce
dedup at edit time with shared/scripts/sync-mirrors.sh:

  - bash shared/scripts/sync-mirrors.sh           # propagate canonicals
  - bash shared/scripts/sync-mirrors.sh --check   # CI: fail on drift

Mirror map (source | mirrors):
  shared/scripts/subscribe-modal.js -> {site, book/quarto, labs, kits,
                                        mlsysim/docs}/.../subscribe-modal.js

Intentional non-mirrors (left untouched, customized variants):
  tinytorch/site-quarto/assets/scripts/subscribe-modal.js  (TinyTorch-branded)
  tinytorch/site/_static/subscribe-modal.js                (legacy Sphinx)

Also dedupe the SocratiQ widget bundle via a symlink (safe here because
book/tools/ sits outside any Quarto project, so the resource walker
never touches it):

  book/tools/scripts/socratiQ/bundle.js -> ../../../quarto/tools/scripts/socratiQ/bundle.js

The shared canonical (book/quarto/tools/scripts/socratiQ/bundle.js) is
the version actually referenced and served in production.
2026-04-19 10:31:41 -04:00
Vijay Janapa Reddi
4de23c16d4 feat(mlsysim): unify navbar with Subscribe button to match Labs/Kits
Add subscribe-modal.js and Subscribe navbar button to MLSYSIM docs
site, matching the unified navbar pattern across all components
(Labs, Kits, MLSYSIM). Right-side items now follow the same order:
Downloads, Star, Support, Subscribe, GitHub.
2026-03-14 19:46:00 -04:00