diff --git a/.gitignore b/.gitignore index a641a4d88..7637e636d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,10 +15,11 @@ dist/ # IDE .vscode/ +.idea # Environment files .env # Cypress Video and Screenshots output cypress/screenshots/ -cypress/videos/ \ No newline at end of file +cypress/videos/ diff --git a/packages/docsearch-react/src/useDocSearchKeyboardEvents.ts b/packages/docsearch-react/src/useDocSearchKeyboardEvents.ts index 0e660eb99..eae55ae2a 100644 --- a/packages/docsearch-react/src/useDocSearchKeyboardEvents.ts +++ b/packages/docsearch-react/src/useDocSearchKeyboardEvents.ts @@ -39,7 +39,8 @@ export function useDocSearchKeyboardEvents({ if ( (event.keyCode === 27 && isOpen) || // The `Cmd+K` shortcut both opens and closes the modal. - (event.key.toLowerCase() === 'k' && (event.metaKey || event.ctrlKey)) || + (event.key?.toLowerCase() === 'k' && + (event.metaKey || event.ctrlKey)) || // The `/` shortcut opens but doesn't close the modal because it's // a character. (!isEditingContent(event) && event.key === '/' && !isOpen)