Skip to content
SprecherEast
Issue 649

feat: Tap a word in a post to see its plain definition, from the glossary

Back to our plan
Open
enhancementfrontenduxpriority: lowshared-component

Size: M Depends on: #648.

Problem

In plain words: in the middle of a sentence like "the City's rate fell to 7.0 mills", a neighbor who doesn't know "mill" shouldn't have to leave the article. They should be able to tap the word, read one line, and carry on. It must work with a finger, a keyboard and a screen reader, not only with a mouse hovering.

The owner (Amine, 2026-11-03, Claude Code session, text) asked for an accessible explainer with reusable UI elements.

Today (checked 2026-11-03):

  • Inline blocks are native in Payload. Payload's Lexical BlocksFeature takes inlineBlocks, which are "inserted within text, appearing alongside other content in the same paragraph" (Payload v3 docs, rich-text/blocks). The site's defaultLexical.ts uses BlocksFeature for blocks only.
  • Hover tooltips fail on touch and often fail WCAG 1.4.13. Disclosure (<details>) can't sit inside a paragraph.
  • The kit already has a Radix part (@radix-ui/react-dialog). There's no popover.

Proposed fix

  • An inline term block: it picks a glossary term (#648), and optionally the text shown, for example "mills" for the term "mill".
  • What renders: the word as a button styled like an inline link with a dotted underline. It opens a small panel with the short definition and "More in the glossary" (/glossary#slug).
    • Option 1: native HTML popover and popovertarget, with no client JavaScript. The PR checks browser support against the site's targets.
    • Option 2: if support or focus handling falls short, @radix-ui/react-popover, the same family as the kit's dialog. It goes through security.md's package checks.
    • The PR decides between the two, records why, and keeps the choice behind a kit Term component.
  • Without either: the word is a plain link to the glossary entry.
  • Markdown for agents: <Term slug="mill">mills</Term> (#593's pattern). An unknown slug is refused.
  • Limits: at most the first use of a term per post is marked, so text doesn't fill with underlines.

Native first, one line per step:

  1. Native: Payload inlineBlocks, the HTML popover attribute, and <dfn>.
  2. Official plugins: none.
  3. Open source: @radix-ui/react-popover only if the native popover isn't enough (decided in the PR).
  4. Our code: the inline block config, the Term kit component, the converter pair and tests.

Acceptance criteria

  • Not done: An editor marks a word as a term in a post, and the definition opens with a tap, Enter or Space. Escape closes it, and focus returns to the word.
  • Not done: A screen reader announces the word as a button, and reads the definition when it's opened. axe passes.
  • Not done: Checked at 320 px: the panel stays on screen and never covers the word. Light and dark mode.
  • Not done: The Markdown round-trip passes, and an unknown slug is refused.
  • Not done: The decision on popover versus Radix is recorded on this issue.

Area

frontend, ux

Priority

low


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab