fix: lock button visual state now updates correctly outside edit mode
Fixed bug where the lock/unlock button's icon and title didn't update when toggling lock state outside of edit mode. The logical state changed correctly (widgets locked/unlocked), but the button appearance remained stale. Root Cause: - toggleLock() correctly updates the button element - When in dropdown/menu mode (narrow screens), menu items are static snapshots - Edit mode toggle refreshed the menu (via headerOverflowManager.refresh()) - Lock button toggle did NOT refresh the menu - Result: stale button appearance in dropdown menus Solution: - Added headerOverflowManager.refresh() call after toggleLock() - Follows the exact same pattern as edit mode toggle (lines 323-326) - Uses setTimeout(50ms) to ensure DOM updates complete first Changes: - src/systems/dashboard/dashboardIntegration.js (lines 338-341) Added 4 lines to refresh menu after lock state change Result: Lock button now correctly updates its visual state (icon: lock/lock-open, title: "Lock Widgets"/"Unlock Widgets") whether in edit mode or not, and whether visible directly or in dropdown/hamburger menus.
This commit is contained in:
@@ -335,6 +335,10 @@ function setupDashboardEventListeners(dependencies) {
|
|||||||
if (dashboardManager && dashboardManager.editManager) {
|
if (dashboardManager && dashboardManager.editManager) {
|
||||||
console.log('[RPG Companion] Lock button clicked');
|
console.log('[RPG Companion] Lock button clicked');
|
||||||
dashboardManager.editManager.toggleLock();
|
dashboardManager.editManager.toggleLock();
|
||||||
|
// Refresh header overflow menu to reflect lock button state change
|
||||||
|
if (headerOverflowManager) {
|
||||||
|
setTimeout(() => headerOverflowManager.refresh(), 50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user