From d980545375c51df20c35ae61e5cf95b96a3b5e44 Mon Sep 17 00:00:00 2001 From: bubba Date: Thu, 20 Jun 2024 17:38:28 +0000 Subject: [PATCH] Fix keyboard navigation conflicting while pausing playback. --- .../player/internals/KeyboardEvents.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/player/internals/KeyboardEvents.tsx b/src/components/player/internals/KeyboardEvents.tsx index af2724c9..d03132c3 100644 --- a/src/components/player/internals/KeyboardEvents.tsx +++ b/src/components/player/internals/KeyboardEvents.tsx @@ -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