Skip to content

fix: claim / key when opening search - #240

Merged
squidfunk merged 1 commit into
zensical:masterfrom
johncarmack1984:fix/claim-search-shortcut
Sep 25, 2026
Merged

squidfunk merged 1 commit into
zensical:masterfrom
johncarmack1984:fix/claim-search-shortcut

Conversation

@johncarmack1984

Copy link
Copy Markdown
Contributor

Summary

The / shortcut opens search but doesn't claim the key. Firefox reads an unclaimed / as its Quick Find shortcut, so the find bar opens on top of the search dialog and takes focus from the query. You have to click back into the search field before you can type.

Claiming the key once search is open keeps Firefox out of it. Material for MkDocs claimed / the same way.

Related issue

None, it's a small self-contained fix. Found while adding arrow-key paging to the MapLibre Martin docs (maplibre/martin#3385), which works around it from a page script for now.

Validation

  • npm run build. The unmodified tree rebuilds dist byte for byte, so the dist diff is only this change.
  • Headless Chrome against the Martin docs, built with no page scripts and served with the rebuilt bundle: / still opens search with the query focused, the / keydown now arrives default-prevented (it didn't before), and a / typed inside the query still lands in the query.
  • Firefox, by hand: claiming the key keeps Quick Find closed. I checked that with the same claim applied from a page script on the Martin docs, not with this build.

Checklist

  • I have followed the pull request guide and kept this change focused
  • This is a small, self-contained fix, or the scope and approach were agreed in the linked issue
  • I have added or updated tests and documentation where relevant (no test suite covers the keyboard handlers, and nothing in the docs changes)
  • I have recorded the checks performed and any remaining validation above
  • I have cryptographically signed each commit and included a Signed-off-by trailer, accepting the DCO
  • I have reviewed and understand the changes, and can explain and revise them – see AI-assisted contributions

Signed-off-by: John Carmack <johncarmack@me.com>
@squidfunk

Copy link
Copy Markdown
Member

Thanks for the PR and quick fix! I'm astonished this is the first time it is reported – not a Firefox user myself 😅

@squidfunk
squidfunk merged commit 2ba6c99 into zensical:master Sep 25, 2026
1 check passed
@johncarmack1984
johncarmack1984 deleted the fix/claim-search-shortcut branch September 25, 2026 14:27
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