Add quick search shortcut to docs #12477
Merged
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.
Description
I'm the type of person that prefers to use keyboard shortcuts and naviation as much as possible. It's become extremely common to have
Ctrl+K
initiate a search in library documentation. Some examples: ESLint, React, Prettier. I don't know them by name but I'd assume most "doc generation" libraries offer this option at this point.This PR adds this shortcut as an option to our own docs.
It also opens the first "result"/item in the sidebar when hitting enter while the class filter is focused.
These two small changes make it sooo much nicer to quickly jump around different pages of docs if you know the name. There's likely many other changes we could do to improve our documentation (like searching properties??) but this seemed like a very small but quick win.
Demo:
simplescreenrecorder-2025-02-13_13.22.18.mp4
Issue number and link
No issue
Testing plan
npm run build-docs
npm start
and open the docs page locallyCtrl+k
and make sure it focuses the search on the home page and class pagesAuthor checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change