diff --git a/index.html b/index.html
index 48896ea..8c75cbb 100644
--- a/index.html
+++ b/index.html
@@ -2997,6 +2997,22 @@
+
+
+
+
+ Close Queue on Navigation
+ Close the queue panel when navigating back or to a new page (useful for
+ mobile)
+
+
+
+
diff --git a/js/app.js b/js/app.js
index df2b525..dc74dab 100644
--- a/js/app.js
+++ b/js/app.js
@@ -7,6 +7,7 @@ import {
downloadQualitySettings,
sidebarSettings,
pwaUpdateSettings,
+ queueBehaviorSettings,
} from './storage.js';
import { UIRenderer } from './ui.js';
import { Player } from './player.js';
@@ -1810,6 +1811,11 @@ document.addEventListener('DOMContentLoaded', async () => {
return;
}
+ // Close side panel (queue/lyrics) on navigation if setting is enabled
+ if (queueBehaviorSettings.shouldCloseOnNavigation()) {
+ sidePanelManager.close();
+ }
+
await router();
updateTabTitle(player);
};
diff --git a/js/settings.js b/js/settings.js
index a2bd5f7..b4832b3 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -32,6 +32,7 @@ import {
contentBlockingSettings,
musicProviderSettings,
analyticsSettings,
+ queueBehaviorSettings,
} from './storage.js';
import { audioContextManager, EQ_PRESETS } from './audio-context.js';
import { getButterchurnPresets } from './visualizers/butterchurn.js';
@@ -1532,6 +1533,15 @@ export function initializeSettings(scrobbler, player, api, ui) {
});
}
+ // Queue Close on Navigation Toggle
+ const queueCloseOnNavigationToggle = document.getElementById('queue-close-on-navigation-toggle');
+ if (queueCloseOnNavigationToggle) {
+ queueCloseOnNavigationToggle.checked = queueBehaviorSettings.shouldCloseOnNavigation();
+ queueCloseOnNavigationToggle.addEventListener('change', (e) => {
+ queueBehaviorSettings.setCloseOnNavigation(e.target.checked);
+ });
+ }
+
// Compact Artist Toggle
const compactArtistToggle = document.getElementById('compact-artist-toggle');
if (compactArtistToggle) {
diff --git a/js/storage.js b/js/storage.js
index 5e71076..60548fe 100644
--- a/js/storage.js
+++ b/js/storage.js
@@ -2101,6 +2101,28 @@ export const musicProviderSettings = {
},
};
+export const queueBehaviorSettings = {
+ STORAGE_KEY: 'queue-close-on-navigation',
+
+ shouldCloseOnNavigation() {
+ try {
+ // Default to true on mobile, false on desktop
+ const saved = localStorage.getItem(this.STORAGE_KEY);
+ if (saved === null) {
+ // Auto-detect: default to true for mobile/touch devices
+ return window.matchMedia('(pointer: coarse)').matches;
+ }
+ return saved === 'true';
+ } catch {
+ return false;
+ }
+ },
+
+ setCloseOnNavigation(enabled) {
+ localStorage.setItem(this.STORAGE_KEY, enabled ? 'true' : 'false');
+ },
+};
+
export const contentBlockingSettings = {
BLOCKED_ARTISTS_KEY: 'blocked-artists',
BLOCKED_TRACKS_KEY: 'blocked-tracks',