Skip to content

Commit

Permalink
fix: do not process shortcut in input fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ambar committed Feb 7, 2022
1 parent be5f556 commit 87faf57
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/griffith/src/components/usePlayerShortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type Options = {
onSeek: (currentTime: number) => void
}

const isInput = (el: HTMLElement) =>
/^(input|textarea|select)$/i.test(el.tagName) || el.isContentEditable

const usePlayerShortcuts = ({
root,
prevVolumeRef,
Expand Down Expand Up @@ -75,6 +78,10 @@ const usePlayerShortcuts = ({
return
}

if (event.target && isInput(event.target as HTMLElement)) {
return
}

let handled = true
switch (event.key) {
case ' ':
Expand Down

0 comments on commit 87faf57

Please sign in to comment.