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..a23aab1cd 100644 --- a/packages/docsearch-react/src/useDocSearchKeyboardEvents.ts +++ b/packages/docsearch-react/src/useDocSearchKeyboardEvents.ts @@ -39,7 +39,11 @@ 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)) || + // We need to check for `event.key` because it can be `undefined` with + // Chrome's autofill feature. + // See https://github.com/paperjs/paper.js/issues/1398 + (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)