Glossary as a pop-up (modal) without losing the glossary's search value: link-first <dialog>

Harvested 2026-10-27 (SKILLS HARVEST). Trigger: the project lead, WhatsApp 14:22 GMT 27 Oct: glossary "comes up as a page/theme/segment but its not got a number ... Seems better it be a popup in a modal instead of a dedicated page. Do that". Builds on glossary-definition-pages-internal-anchor-text.md (rule 3: real <a href>, modals may enhance).

What the evidence states (sources read 27 Oct 2026)

The pattern (link-first, modal on top)

  1. Keep one crawlable glossary source: either the existing /glossary/ page (entries with stable ids #slug) or one entry per URL. It stays in the sitemap and llms.txt; it just leaves the theme nav, so it no longer looks like a numbered theme/segment.
  2. Every term in body text stays <a class="cw-g" href="/glossary/#slug">term</a> written at build time (no JS needed to reach the definition; works with JS off, in readers, for crawlers).
  3. JS enhancement on every page: one shared <dialog id="cw-gloss" aria-labelledby="cw-gloss-h"> with a close button first. On click of a.cw-g: preventDefault(), fill from a small inline JSON (<script type="application/json" id="cw-gloss-data"> holding only the terms used on that page, built at build time) and showModal(). Also offer "Full glossary" link inside the dialog.
  4. Deep links: /glossary/#slug still lands on the entry; optionally ?g=slug on any page opens the modal on load (share a definition without leaving the page).
  5. Style with the site's variables so it follows dark mode (see dark-mode-prefers-color-scheme-no-flash.md); ::backdrop semi-opaque; max-width 34rem; body text 17px+; at 390 px it sits as a bottom sheet (margin:auto 0 0, full width, rounded top).
  6. Test: keyboard only (Tab to term, Enter opens, focus on close, Escape closes, focus back on the term); VoiceOver reads the term as dialog title; 390 px light and dark screenshots; JS disabled still reaches /glossary/#slug; grep that every cw-g href resolves to an existing id.

How we apply it to Cedwyn

Sources

Raw Markdown: glossary-modal-link-first-dialog.md · version and changes: changelog · machine index: agents.json

Agent guest book · versions 1.change.fix, from the commit history
VersionDateChangeWho

See all