Skip to content

Search button intercepts browser shortcuts when focused #2855

@brc-dd

Description

@brc-dd

Description

See facebook/docusaurus#11725

Steps to reproduce

  1. Go to https://docusaurus.io/
  2. Focus the search button
  3. Press Cmd+Opt+I
  4. See Dead being set as initial query in the search modal.

Expected behavior

The browser devtools should open in that case.

This part will need modification -

const onInput = React.useCallback(
(event: KeyboardEvent): void => {
setDocsearchState('modal-search');
setInitialQuery(event.key);
},
[setDocsearchState, setInitialQuery],
);

e.key is Dead in Chromium in certain cases (and likely in other browsers too according to MDN, but I wasn't able to reproduce).

It shouldn't intercept stuff when Ctrl or Cmd is held I guess. For example, if the search button is focussed and you try to do Cmd+R for reload, it opens the modal with r typed instead.

Environment

  • OS: macOS 26.2
  • Browser: Chromium 144.0.7559.96
  • DocSearch version: 4.4.0

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions