From 4b373560c67699df7e85b55d347b43d082e2373b Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 5 Feb 2021 13:03:36 -0500 Subject: [PATCH] Do not trigger next/prev event handlers when Cmd (meta) is pressed --- ui/src/audioplayer/Player.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ui/src/audioplayer/Player.js b/ui/src/audioplayer/Player.js index 76ef3f807..f0dcd508d 100644 --- a/ui/src/audioplayer/Player.js +++ b/ui/src/audioplayer/Player.js @@ -93,12 +93,18 @@ const Player = () => { (audioInstance.volume = Math.min(1, audioInstance.volume + 0.1)), VOL_DOWN: () => (audioInstance.volume = Math.max(0, audioInstance.volume - 0.1)), - PREV_SONG: useCallback(() => { - if (prevSong()) audioInstance && audioInstance.playPrev() - }, [prevSong]), - NEXT_SONG: useCallback(() => { - if (nextSong()) audioInstance && audioInstance.playNext() - }, [nextSong]), + PREV_SONG: useCallback( + (e) => { + if (!e.metaKey && prevSong()) audioInstance && audioInstance.playPrev() + }, + [prevSong] + ), + NEXT_SONG: useCallback( + (e) => { + if (!e.metaKey && nextSong()) audioInstance && audioInstance.playNext() + }, + [nextSong] + ), } const defaultOptions = {