docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

triggering search via cmd+k captures all future keystrokes

Open mguida22 opened this issue 1 month ago • 3 comments

Have you read the Contributing Guidelines on issues?

Prerequisites

  • [x] I'm using the latest version of Docusaurus.
  • [ ] I have tried the npm run clear or yarn clear command.
  • [ ] I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • [ ] I have tried creating a repro with https://new.docusaurus.io.
  • [ ] I have read the console error message carefully (if applicable).

Description

Once someone has entered the search component via cmd+K, all future keystrokes are sent to the search even when it's closed. This makes it impossible to use commands like cmd+R or cmd+L because they are captured in search.

I've tested this on a mac using chrome. It is reproducible on https://docusaurus.io/ as well as my site running docusaurus 3.9.2 and 3.8.1.

Reproducible demo

reproducible on the Docusaurus docs

Steps to reproduce

  1. go to https://docusaurus.io/
  2. enter cmd+K to bring up search
  3. enter escape to close search
  4. enter cmd+R to reload. Notice that this doesn't reload the page but instead opens the search modal with the text r

Expected behavior

Commands like cmd+R and similar are executed properly and not captured by search.

Actual behavior

the text is captured in the search input

Your environment

  • Public source code: https://docusaurus.io/
  • Public site URL: https://docusaurus.io/
  • Docusaurus version used: I've reproduced on 3.9.2 and 3.8.1
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome Version 142.0.7444.176 (Official Build) (arm64)
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Sequoia 15.6.1

Self-service

  • [ ] I'd be willing to fix this bug myself.

mguida22 avatar Nov 26 '25 21:11 mguida22