From 9b85b5d3f82578be0fe43abf3706cc872a49df46 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Fri, 26 Jul 2024 14:40:17 +0200 Subject: [PATCH] fix(search): fix algolia search ignore ctrl + F in search input --- .../src/theme/SearchBar/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx index 1325a2c2e9dd..aea9f0601361 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx @@ -156,6 +156,10 @@ function DocSearch({ const handleInput = useCallback( (event: KeyboardEvent) => { + if (event.key === 'f' && (event.metaKey || event.ctrlKey)) { + // ignore browser's ctrl+f + return; + } // prevents duplicate key insertion in the modal input event.preventDefault(); setInitialQuery(event.key);