Skip to content

triggering search via cmd+k captures all future keystrokes #11572

@mguida22

Description

@mguida22

Have you read the Contributing Guidelines on issues?

Prerequisites

  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondomain: searchRelated to the search feature, usually AlgoliaexternalThis issue is caused by an external dependency and not Docusaurus.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions