Skip to content

Commit

Permalink
Merge pull request #58 from rxnk/main
Browse files Browse the repository at this point in the history
Fix keyboard navigation conflicting while pausing playback.
  • Loading branch information
Captain Jack Sparrow authored Jun 21, 2024
2 parents e92e214 + d980545 commit 5be4f14
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/player/internals/KeyboardEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,17 @@ export function KeyboardEvents() {

// Utils
if (keyL === "f") dataRef.current.display?.toggleFullscreen();
if (k === " " || keyL === "k")
dataRef.current.display?.[
dataRef.current.mediaPlaying.isPaused ? "play" : "pause"
]();
if (k === " " || keyL === "k") {
if (
evt.target &&
(evt.target as HTMLInputElement).nodeName === "BUTTON"
) {
return;
}

const action = dataRef.current.mediaPlaying.isPaused ? "play" : "pause";
dataRef.current.display?.[action]();
}
if (k === "Escape") dataRef.current.router.close();

// captions
Expand Down

0 comments on commit 5be4f14

Please sign in to comment.