Repository navigation
Add a search box under the greeting - #46
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
/docs/search-index.json(abap2UI5/docs,scripts/generate-search.mjs).public/search-engine.js(=scripts/lib/search-engine.jsin abap2UI5/docs, unchanged): ranking, typo tolerance ("tabel" → "table"), grouping./to focus, arrows + Enter, Escape closes / clears. A result opens in the same tab.The rule this changes
AGENTS.mdsaid 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 gainsconnect-src 'self'. The box ishiddenin the markup and shown by the script, so without JS there is no dead field. The About page stays script-free.Tests
<script type="module" src="/search.js">, nothing inline, policy hasscript-src 'self'andconnect-src 'self', About has none.search.jsuses 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