From c39d348a8126c2bfdecba65256906b6c5f499d8a Mon Sep 17 00:00:00 2001 From: Lucas 'Paperboy' Rose-Winters Date: Mon, 27 Oct 2025 20:06:25 +1100 Subject: [PATCH] fix(dashboard): properly filter dropdown menu buttons based on pre-hidden visibility - Store button visibility state before hiding them in overflow/compact modes - Use stored wasVisible data attribute to filter which buttons to show - Prevents hidden buttons (like Done) from appearing inappropriately - Also prevents visible buttons from being excluded when they're hidden by overflow manager - Full mode now checks inline style to respect template display:none --- .../dashboard/headerOverflowManager.js | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/systems/dashboard/headerOverflowManager.js b/src/systems/dashboard/headerOverflowManager.js index 47628f0..7fd9063 100644 --- a/src/systems/dashboard/headerOverflowManager.js +++ b/src/systems/dashboard/headerOverflowManager.js @@ -143,9 +143,13 @@ export class HeaderOverflowManager { setFullMode() { // Show all overflow buttons this.overflowButtons.forEach(btn => { - if (btn.dataset.editMode === 'true' || !btn.hasAttribute('data-edit-mode')) { + // Only show buttons that don't have inline display:none in the template + const inlineStyle = btn.getAttribute('style'); + if (!inlineStyle || !inlineStyle.includes('display: none')) { btn.style.display = ''; } + // Clear the wasVisible flag + delete btn.dataset.wasVisible; }); // Hide menu buttons @@ -158,7 +162,12 @@ export class HeaderOverflowManager { */ setOverflowMode() { // Hide overflow buttons (will be in dropdown) - this.overflowButtons.forEach(btn => btn.style.display = 'none'); + // Store original visibility before hiding + this.overflowButtons.forEach(btn => { + const computedStyle = window.getComputedStyle(btn); + btn.dataset.wasVisible = computedStyle.display !== 'none' ? 'true' : 'false'; + btn.style.display = 'none'; + }); // Show overflow menu button this.overflowMenuBtn.style.display = ''; @@ -173,7 +182,12 @@ export class HeaderOverflowManager { */ setCompactMode() { // Hide all overflow buttons - this.overflowButtons.forEach(btn => btn.style.display = 'none'); + // Store original visibility before hiding + this.overflowButtons.forEach(btn => { + const computedStyle = window.getComputedStyle(btn); + btn.dataset.wasVisible = computedStyle.display !== 'none' ? 'true' : 'false'; + btn.style.display = 'none'; + }); // Show hamburger menu button this.overflowMenuBtn.style.display = 'none'; @@ -194,10 +208,9 @@ export class HeaderOverflowManager { ? [...this.overflowButtons] : this.overflowButtons; - // Filter visible buttons (considering edit mode) + // Filter visible buttons (only include buttons that were visible before being hidden) const visibleButtons = buttonsToShow.filter(btn => { - const computedStyle = window.getComputedStyle(btn); - return computedStyle.display !== 'none' || !btn.hasAttribute('data-edit-mode'); + return btn.dataset.wasVisible === 'true'; }); if (visibleButtons.length === 0) { @@ -240,11 +253,6 @@ export class HeaderOverflowManager { this.closeMenu(); }); - // Handle edit mode visibility - if (button.style.display === 'none' && button.dataset.editMode === 'true') { - item.style.display = 'none'; - } - return item; }