a simple but full-featured web player for OpenSubsonic music servers (Navidrome, Gonic, Ampache, etc) devins.page/tinysub

Patch: keyboard shortcuts eat browser shortcuts #141

Closed devins.page
Closed opened by devins.page

Hello,

Awesome project! It's my new favourite thing.

A quick patch as I found the keyboard shortcuts eat the browser shortcuts in Firefox on macOS (cmd-L to focus Firefox's location bar, cmd-K to focus search, cmd-J to bring up downloads). Sorry this is not a PR, I could not figure out tangled.

commit 4c203c0959a7b57977c6965c626be25a676ae3ac
Author: Paul W. Rankin <rnkn@rnkn.xyz>
Date:   Tue Oct 6 16:54:36 2026 +1100

    controls: avoid eating browser keyboard shortcuts

diff --git a/src/lib/app/lifecycle.svelte.ts b/src/lib/app/lifecycle.svelte.ts
index 788eecb..95942f4 100644
--- a/src/lib/app/lifecycle.svelte.ts
+++ b/src/lib/app/lifecycle.svelte.ts
@@ -35,11 +35,11 @@ export const onGlobalKey = (event: KeyboardEvent) => {
 	} else if (cmd && key === "y") {
 		event.preventDefault();
 		redo();
-	} else if (code === "Space" || code === "KeyK") {
+	} else if ((code === "Space" || code === "KeyK") && !cmd) {
 		event.preventDefault();
 		toggle();
 		animateActivation("#playback-toggle");
-	} else if (code === "KeyJ" && !shift) {
+	} else if (code === "KeyJ" && !shift && !cmd) {
 		event.preventDefault();
 		if (alt) {
 			prev();
@@ -48,7 +48,7 @@ export const onGlobalKey = (event: KeyboardEvent) => {
 			seek(Math.max(0, player.time - 10));
 			animateActivation("#playback-progress .progress-bar");
 		}
-	} else if (code === "KeyL" && !shift) {
+	} else if (code === "KeyL" && !shift && !cmd) {
 		event.preventDefault();
 		if (alt) {
 			next();

No worries, I’ll apply this later, thanks!

Applied in 2.80.4

Awesome, thanks!

Sign up or Sign in to add to the discussion.