Repository navigation
Focus the API search box when "/" is pressed - #4511
Merged
Merged
Conversation
Pressing `/` outside a text field now focuses the sidebar search box on API pages, and `Esc` clears it and drops focus, as on GitHub. The placeholder reads `Press ❲/❳ to search API`. The shortcut applies only to `type="api"` on screens at least 768px wide. This addresses [elastic/docs-eng-team#1096](elastic/docs-eng-team#1096). Its Ctrl+K complaint came from a build older than [#4411](#4411), which already removed that handler. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
reakaleek
reviewed
Oct 19, 2026
The box has gone by names such as "Jump to page" and "Find in docs" so it is not confused with the site search. The placeholder now reads `Press ❲/❳ to find API`, and the docs call the box a finder. This follows review feedback on [#4511](#4511). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
reakaleek
approved these changes
Oct 19, 2026
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4511/ Sample changed pages: |
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.
Pressing
/outside a text field now focuses the search box in the API sidebar, andEscclears it and drops focus, as on GitHub. The placeholder readsPress ❲/❳ to find API.Affects:
Site UI,API referencePrompt summary: Make the API Explorer's jump-to-page box behave like GitHub's search box. Typing
/focuses it, and the placeholder tells readers so. elastic/docs-eng-team#1096 tracks the request.For full context, this intends to result in the following functionality:
Ctrl+F- find in page, built into the browserCtrl+K- generally mapped to broader search functionality (website search, browser search)/- used in GitHub and similar for searching for code or code artifacts - originates from vim, etc - mapped here to the functionality to search within the API contentWhy
The search box in the API sidebar has no keyboard shortcut, and nothing in the box says one could exist. Readers click into it every time. GitHub users expect
/to do this.What
Slash focuses the search box
Pressing
/on an API page focuses the sidebar search box and selects its text, without typing the slash. The key is ignored inside text fields, with Ctrl, Meta or Alt held, and on screens narrower than 768px, where the sidebar is off-canvas. Shift is allowed because some keyboard layouts need it to type/. The logic lives in the newuseSlashToFocushook.Placeholder names the shortcut
The API placeholder changes from
Find in all APIstoPress ❲/❳ to find API, and the input getsaria-keyshortcuts="/"so assistive technology can announce the shortcut. Other uses of the component keep their placeholder and get no shortcut. The API Explorer page indocs/names the box by its new placeholder and describes the shortcut.Escape leaves the box
Escalready cleared the box and closed the results. On API pages it now also drops focus, as on GitHub. The blur waits for the re-render, so oneEsclogs onenavigation_search_closedevent instead of two.Verify
cd src/Elastic.Documentation.Site npx jest Assets/web-components/NavigationSearchCheck on the preview
/outside a field: the sidebar box takes focus with no slash typed, andEscclears it and drops focus./does nothing.Out of scope: Ctrl+K is untouched. The handler that sent it to this box was removed in #4411, so the report in the issue came from an older build. Whether API pages should mount the header search is a separate question.
🤖 Generated with Claude Code