allow users to type the letter n

This commit is contained in:
hzrd149 2024-02-05 12:01:13 +00:00
parent ad6e51ed98
commit 1c8f68f66f
2 changed files with 4 additions and 1 deletions

View File

@ -17,7 +17,9 @@ export default function KeyboardShortcut({
(e) => (requireMeta ? e.ctrlKey || e.metaKey : true) && e.key === letter,
(e) => {
// ignore if the user is focused on an input
if (document.activeElement instanceof HTMLInputElement) return;
if (document.activeElement instanceof HTMLInputElement || document.activeElement instanceof HTMLTextAreaElement) {
return;
}
if (onPress) {
e.preventDefault();

View File

@ -34,6 +34,7 @@ function LaunchpadPage() {
<Flex gap="4" w="full">
<Button colorScheme="primary" size="lg" onClick={() => openModal()} variant="outline">
New Note
<KeyboardShortcut letter="n" ml="2" onPress={(e) => openModal()} />
</Button>
<SearchForm flex={1} />
</Flex>