Merge pull request #58 from rxnk/main

Fix keyboard navigation conflicting while pausing playback.
This commit is contained in:
Captain Jack Sparrow 2024-06-20 21:16:51 -04:00 committed by GitHub
commit 5be4f1458d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 4 deletions

View File

@ -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