← Hub · Open the note

Search highlighting (find-in-page) — demo — BEFORE/AFTER

Goal: highlight matches with a shape (not color-only), show a calm count, and support Next/Previous match without stealing focus.

Try it

Type a term like the, garden, or weaver. Then use Next/Prev to move the “current match” marker in the AFTER panel.

Shortcuts: Enter = Next, Shift+Enter = Prev, Esc = Clear (when not typing in the input).

BEFOREHighlight is color-only + no count + no navigation

Problems: relies on link-blue text, doesn’t tell you how many matches exist, and resets the entire document with innerHTML on every keystroke.

(No status.)

AFTERSemantic <mark> + visible shape + calm status + next/prev

Pattern: rebuild from textContent, wrap matches in <mark>, add a distinct “current match” outline, and announce counts via role="status".

Quick checklist