Skip to content

Commit

Permalink
Fix keyboard navigation conflicting while pausing playback.
Browse files Browse the repository at this point in the history
  • Loading branch information
rxnk committed Jun 20, 2024
1 parent e92e214 commit d980545
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 d980545

Please sign in to comment.