Skip to content

Commit

Permalink
Merge d871f0b into 3237ea3
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed Dec 14, 2021
2 parents 3237ea3 + d871f0b commit ed0db6d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/client/theme/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,10 @@ export default function SearchBar({
searchBarRef.current?.focus();
}
}
// "keydown" is the only way to capture the "command" key on mac.
// Then we use the metaKey boolean prop to see if the "command" key was pressed.
const eventType = isMac ? "keydown" : "keypress";
document.addEventListener(eventType, handleShortcut);

document.addEventListener("keydown", handleShortcut);
return () => {
document.removeEventListener(eventType, handleShortcut);
document.removeEventListener("keydown", handleShortcut);
};
}, [isMac]);

Expand Down

0 comments on commit ed0db6d

Please sign in to comment.