Skip to content

feat: key press of slash focuses search bar#1018

Merged
bglw merged 1 commit intoPagefind:mainfrom
miketheman:miketheman/focus-search-on-keypress
Feb 8, 2026
Merged

feat: key press of slash focuses search bar#1018
bglw merged 1 commit intoPagefind:mainfrom
miketheman:miketheman/focus-search-on-keypress

Conversation

@miketheman
Copy link
Contributor

First time caller, hope I got it right.

Having used search on websites and loving the keyboard focus, and recognizing that autofocus can solve the issue, yet introduces accessibility concerns, I thought that adding the ability to implement to opt in to a method for surfacing the feature.

Happy to take some feedback, this isn't the most familiar code for me yet.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman requested a review from bglw as a code owner February 2, 2026 14:08
Copy link
Member

@bglw bglw left a comment

Choose a reason for hiding this comment

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

Hey @miketheman! 👋

These changes look all ok, though I will note that we're on the threshold of the 1.5.0 release, which brings an entirely new UI: https://ui.pagefind.app/

The existing "default ui" won't be removed, though it will become somewhat deprecated in favor of the new UI components.

@miketheman
Copy link
Contributor Author

Oh, that's very cool! Glancing at the docs, it doesn't look like there's an option in the new component style to have a single key press like slash, it must have a modifier?

@bglw
Copy link
Member

bglw commented Feb 8, 2026

Currently yep, but that can be adjusted :)

@miketheman
Copy link
Contributor Author

Cool, I'll have to take a look. In the meantime, if this makes it in, we could start using it on the existing UI

@bglw bglw merged commit 72da534 into Pagefind:main Feb 8, 2026
5 checks passed
@miketheman miketheman deleted the miketheman/focus-search-on-keypress branch February 8, 2026 11:35
@miketheman
Copy link
Contributor Author

Currently yep, but that can be adjusted :)

Challenge accepted - first commit on #1025 does that

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