Skip to content

Add a search box under the greeting - #46

Merged
oblomov-dev merged 1 commit into
mainfrom
claude/beautiful-gauss-3dlvr3
Nov 1, 2026
Merged

oblomov-dev merged 1 commit into
mainfrom
claude/beautiful-gauss-3dlvr3

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

What

A search field directly under "Welcome to abap2UI5", the logo beside both; on a phone the field takes the whole width under them. It searches the documentation and the three sample catalogues (Samples, Controls, Stack) in one list, grouped by area, the matched words marked.

  • Reads the index the docs already publish on this origin for the playground: /docs/search-index.json (abap2UI5/docs, scripts/generate-search.mjs).
  • Matches with a copy of the docs' matcher, public/search-engine.js (= scripts/lib/search-engine.js in abap2UI5/docs, unchanged): ranking, typo tolerance ("tabel" → "table"), grouping.
  • The index is fetched the first time the box is used, never at load. Nothing is stored.
  • Keys: Ctrl/⌘ K or / to focus, arrows + Enter, Escape closes / clears. A result opens in the same tab.
  • If the index cannot be loaded, the list says so and links to the docs.

The rule this changes

AGENTS.md said No script. It now says One script: the search: public/search.js, a module of this origin, on the home page only (<Page search>). Still no inline script, no handler attribute, no inline style; the CSP gains connect-src 'self'. The box is hidden in the markup and shown by the script, so without JS there is no dead field. The About page stays script-free.

Tests

  • The "no script" test becomes: exactly one <script type="module" src="/search.js">, nothing inline, policy has script-src 'self' and connect-src 'self', About has none.
  • New: the box is hidden in the markup; search.js uses the matcher beside it and /docs/search-index.json, touches no storage and builds no HTML from strings; the copied engine exports what the box imports.

npm run check: 7 pass, 0 fail. Checked by hand in Chromium against the live index (light/dark, desktop/390px, keyboard, the unavailable case).


Generated by Claude Code

The home page gets a search over the documentation and the three sample
catalogues, under "Welcome to abap2UI5", the logo beside both (on a phone
the box takes the whole width under them).

It reads the index the docs already publish on this origin for the
playground, /docs/search-index.json, with a copy of the docs' matcher
(public/search-engine.js, from abap2UI5/docs scripts/lib/search-engine.js),
fetched the first time the box is used. Results grouped by area, the
matched words marked, arrows and Enter, Ctrl/Cmd K and "/" to focus.

This lifts the page's "no script" rule to "one script": public/search.js,
a module of this origin, on the home page only. The policy gains
connect-src 'self'; nothing inline, nothing stored, and the box is hidden
until the script shows it. AGENTS.md and the tests say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014YZFmFLTfBmZJXKPuRQWci
@oblomov-dev
oblomov-dev merged commit 39d9b8d into main Nov 1, 2026
2 checks passed
@oblomov-dev
oblomov-dev deleted the claude/beautiful-gauss-3dlvr3 branch November 1, 2026 13:55
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