Skip to content

Commit

Permalink
fix: event.key is undefined algolia#1887
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfulyang committed May 16, 2023
1 parent bae117c commit db686ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -15,10 +15,11 @@ dist/

# IDE
.vscode/
.idea

# Environment files
.env

# Cypress Video and Screenshots output
cypress/screenshots/
cypress/videos/
cypress/videos/
3 changes: 2 additions & 1 deletion packages/docsearch-react/src/useDocSearchKeyboardEvents.ts
Expand Up @@ -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)
Expand Down

0 comments on commit db686ba

Please sign in to comment.