8000 Explain specialised terms in the page copy with a hover popover by Sun518-ai · Pull Request #3 · chainhelen/neural-atelier · GitHub
[go: up one dir, main page]

Skip to content

Explain specialised terms in the page copy with a hover popover - #3

Merged
chainhelen merged 3 commits into
chainhelen:mainfrom
Sun518-ai:feature/glossary-terms
Nov 10, 2026
Merged

chainhelen merged 3 commits into
chainhelen:mainfrom
Sun518-ai:feature/glossary-terms

Conversation

@Sun518-ai
Copy link
Copy Markdown

Summary

  • Add a curated glossary (glossary.js) that gives 21 specialised terms in the page copy a dashed underline and a short definition in a hover/focus popover, written in the language the interface is currently showing.
  • Cover the mission panel, level menu and level choices, route strip, device dock, hint/structure dialog, module card, shelf notes, run report and static prose. Matching is curated and exact: FFNX stays plain, FFNs and tokens are deliberate plural aliases, and nothing is marked inside <code>, vector/matrix cells or numeric labels.
  • Keep the highlighting across language switches. Static prose keeps one Chinese source and is re-rendered in the active language; every copy rewrite re-runs the scan, so a term is never marked twice and marked spans survive a re-render.
  • Follow the existing #shelf-tooltip pattern with a second #glossary-popover: anchored above or below the term so it never covers it, dismissed on pointer leave, blur, scroll, dialog close and Escape, prefers-reduced-motion aware, and the definition exposed through aria-describedby on a focusable term.

Test Plan

  • npm test — 325 tests passed.
  • New ui-smoke.test.cjs case boots the page and asserts the FFN wrapping, the popover content and dismissal, the keyboard focus path, the language switch, and the token-boundary rules.
  • New scene-smoke.test.cjs case asserts the module card prose marks its terms and keeps them explained in both languages.

@Sun518-ai
Copy link
Copy Markdown
Author

Real-browser verification on this branch's head (9888b9b, based on upstream main a049375), driven with real Google Chrome + WebGL:

序章 / 06 — regression on the merged matrix fix (#2)

  • The level now validates 5/5 and pops 「本关完成」.
  • During the two extra validation samples the input matrix's first row swaps to the current sample: 新输入 A [-1, 2] → 新输入 B [2, -0.5]; the output matrix's first row is labelled A / B with [0, 0.6] / [1, 0.8].
  • HUD, footer trial hint and the side panel follow along (3 / 5 → 4 / 5 → 5 / 5).
  • Final run rows: 我 [0.55, 0.35], 爱 [0.1, 0.4], 猫 [0.7, 0.6], 新输入 A [0, 0.6], 新输入 B [1, 0.8].

Glossary layer (this PR)

  • 115 terms are marked on the 序章/06 page (tabindex="0", aria-describedby="glossary-popover").
  • Hover opens the popover (rendered, opacity: 1, z-index: 101) with term + the other language's name + the definition in the current language + 「更多细节见「原版 FFN · ReLU」模块卡」.
  • The popover is placed above the term and never covers it; Escape closes it, keyboard focus opens the same popover, and switching to English keeps the dashed underlines while the definition switches language.
  • Only console noise is a favicon.ico 404.

Tests

  • npm test on this exact tree: 325 passed / 0 failed (same as CI).

No code changes came out of this verification.

@Sun518-ai
Copy link
Copy Markdown
Author

Follow-up commit e0086fe closes two gaps found while reviewing this PR.

1. The English interface left several curated terms unexplained.
The Chinese copy marks 残差 / 投影 / 激活 / 词表打分 / 多头注意力 where the English copy says residuals, projections, activations, vocabulary scoring and multi-head attention, so an English reader got no popover for them. The About paragraph alone carried 17 explained terms in Chinese and 15 in English. The fix adds the missing English surfaces as aliases, including the verb forms the copy actually uses (project, normalize, normalized), so both languages now mark the same passages.

2. The popover was invisible inside a modal dialog.
#glossary-popover is a position: fixed element in <body>, while <dialog> paints in the top layer above every page element — hovering a term in the level menu, the About dialog or a module card opened a popover that stayed hidden behind the dialog. The popover now moves into the dialog that holds the term and returns to the page when it is dismissed.

Verification

  • npm test: 327 passed / 0 failed (325 before, plus a language-parity test and a dialog test).
  • Real Chrome (headless, WebGL swiftshader): the English About prose marks residuals and multi-head attention; hovering either opens the popover above the term without covering it and Escape closes it; in the level menu the popover now paints above the dialog; Prologue / 06 still passes 5/5 with 新输入 A [0, 0.6] and 新输入 B [1, 0.8].
  • One existing assertion was adjusted: the module card check for “no Chinese in the English interface” now ignores the popover, because the tooltip deliberately shows the other language's name.

This still needs an owner-side merge: the identity available to me has pull-only permission on this repository.

sunshengda added 3 commits November 10, 2026 17:15
…dialogs

The English interface left several curated terms unexplained: the Chinese
copy marks 残差, 投影, 激活, 词表打分 and 多头注意力 where the English copy
says residuals, projections, activations, vocabulary scoring and
multi-head attention, so an English reader got no popover for them.

- Add the missing English surfaces as aliases, including the verb forms the
  copy actually uses (project, normalize) so both languages mark the same
  passages.
- Move the popover into the dialog that holds the term, because a modal
  dialog paints in the top layer above every page element and used to hide
  the explanation.
- Keep the popover out of the scan so its own text is never marked.
The upstream declutter pass rewrote the About prose, so the multi-head
attention it used to name is no longer there. Assert that term on the
mission panel that still introduces it, and keep the residual check.
@Sun518-ai
Sun518-ai force-pushed the feature/glossary-terms branch from e0086fe to f6d310f Compare November 10, 2026 09:30
@chainhelen
chainhelen merged commit a032c4c into chainhelen:main Nov 10, 2026
1 check passed
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.

2 participants

0