Skip to content

Add fuzzy slide search to the cracktro deck - #78149

Merged
pelikhan merged 1 commit into
mainfrom
copilot/add-fuzzy-search-to-slide-deck
Nov 15, 2026
Merged

pelikhan merged 1 commit into
mainfrom
copilot/add-fuzzy-search-to-slide-deck

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Adds a search icon to the talk deck's dock, next to the sound icon. It opens a full-screen dialog that fuzzy-matches each slide's title, slides.md summary and text.

Dock and dialog

  • New .fzb button left of .snd. At ≤360px with compact nav it stacks above sound, so the existing narrow-dock layout test still passes.
  • Uses a native <dialog> with an input (role=combobox) and a result list (role=listbox). It opens with the button, / (except while typing in a form field) or Ctrl/Cmd+K.
  • Inside the dialog, ↑/↓ select a result, Enter goes to it, and Escape or a click on the backdrop closes it. Escape is handled in code, because Chromium can ignore a repeated Escape.
  • While the dialog is open, deck keys, clicks and swipes are ignored. Focus is cleared on close so Space and Enter drive the deck again.

Index (built once, on first open)

Field Source Weight
title headingText() (shared with the band map) 3
summary JSON-LD PresentationDigitalDocument.hasPart[i].description 2
body visible slide text + speaker notes 1
  • The visible text skips aria-hidden, style, script and .line content, and text nodes are joined with spaces.
  • Summaries only exist where the docs build injects the JSON-LD. On a plain static preview the field is empty.

Bounds-based matching

  • fzBounds(text, term) returns the tightest [start, end) span that holds the term's letters in order. Spans wider than n + ceil(n/2) are rejected.
  • Score: n / width, plus a bonus when the span starts a word and a small bonus for appearing early. A field's score is multiplied by its weight.
  • The same spans drive the <mark> highlights, built as DOM nodes (no innerHTML).
  • Every term must match some field. #N returns only slide N, a bare number ranks slide N first, and an empty query lists every slide.
"zero secrt"  → 10 Zero-secret agents
"mdel routng" → model routing slide
"safe outpts" → Safe outputs

Tests and docs

  • New Playwright test in docs/tests/talk.spec.ts covering:
    • button position next to sound
    • a fuzzy title match and its highlights
    • summary search
    • no-results state
    • #N
    • Escape, arrow keys and Enter
  • docs/README.md: the new search keys. .github/skills/cracktro/SKILL.md: a search section marker and the fz- CSS prefix.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 15, 2026 21:24
Copilot AI adaptive review requested due to automatic review settings November 15, 2026 21:24
@pelikhan
pelikhan merged commit 480bf41 into main Nov 15, 2026
61 checks passed
@pelikhan
pelikhan deleted the copilot/add-fuzzy-search-to-slide-deck branch November 15, 2026 21:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Search silently ignores terms beyond the first eight, allowing invalid matches, and keyboard handling intercepts IME composition, causing premature navigation and disrupting candidate selection.

2 open issues
What changed in this PR

Adds fuzzy slide search to the standalone cracktro talk deck, letting users find slides by title, summary, body text, or speaker notes.

Changes:

  • Adds a responsive dock button and full-screen search dialog with keyboard navigation.
  • Implements lazy indexing, weighted fuzzy matching, highlighted results, and slide-number lookup.
  • Adds Playwright coverage and documents search controls and implementation locations.
File Description
docs/​tests/​talk.spec.ts Tests search results, highlights, dialog controls, and navigation.
docs/​README.md Documents search shortcuts and slide-number lookup.
docs/​public/​cracktro/​deck.js Implements search indexing, matching, dialog UI, and input handling.
.github/​skills/​cracktro/​SKILL.md Documents the search section and CSS prefix.

Review effort: Balanced (dynamic)

};
const fzScore = (text, [b, e], n) => n / (e - b) + (b === 0 || /\W/.test(text[b - 1]) ? 0.5 : 0) + 0.25 * (1 - Math.min(b, 400) / 400);
const fzSearch = q => {
const terms = q.toLowerCase().split(/\s+/).filter(Boolean).slice(0, 8);
fzRender();
}
fzIn.addEventListener("input", fzRender);
fz.addEventListener("keydown", e => {
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

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.

3 participants