Skip to content

Commit

Permalink
fix: hotkeys should prevent default
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredLunde committed Apr 25, 2022
1 parent fb01bb1 commit b37b458
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/use-hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export function useHotkeys(fileTree: FileTree, config: UseHotkeysConfig) {
return;
}

event.preventDefault();
const nodeId = getSelectedId();
const selectedIndex = getSelectedIndex();

Expand Down Expand Up @@ -202,6 +203,7 @@ export function useHotkeys(fileTree: FileTree, config: UseHotkeysConfig) {
return;
}

event.preventDefault();
const element = document.querySelector(
querySelectorPattern.replace("{index}", "0")
);
Expand All @@ -222,6 +224,7 @@ export function useHotkeys(fileTree: FileTree, config: UseHotkeysConfig) {
return;
}

event.preventDefault();
const element = document.querySelector(
querySelectorPattern.replace("{index}", visibleNodes.length - 1 + "")
);
Expand All @@ -242,6 +245,7 @@ export function useHotkeys(fileTree: FileTree, config: UseHotkeysConfig) {
return;
}

event.preventDefault();
const rovingId = rovingFocus.didChange.getState();
const selectedIndex = visibleNodes.indexOf(rovingId);

Expand Down

0 comments on commit b37b458

Please sign in to comment.