Fixed calculating compact mode overflow at startup

This commit is contained in:
mr. m
2025-04-09 19:14:56 +02:00
parent 78bc66668c
commit 3bf854c6c3
2 changed files with 16 additions and 4 deletions

View File

@@ -30,10 +30,11 @@
this._initSidebarScrolling();
gZenCompactModeManager.init();
gZenCompactModeManager.preInit();
ZenWorkspaces.init();
gZenVerticalTabsManager.init();
gZenUIManager.init();
gZenCompactModeManager.init();
this._checkForWelcomePage();

View File

@@ -28,15 +28,23 @@ var gZenCompactModeManager = {
_evenListeners: [],
_removeHoverFrames: {},
preInit() {
// Remove it before initializing so we can properly calculate the width
// of the sidebar at startup and avoid overflowing items not being hidden
const isCompactMode = lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode') === 'true';
lazyCompactMode.mainAppWrapper.removeAttribute('zen-compact-mode');
this._wasInCompactMode = isCompactMode;
this.addMouseActions();
this.addContextMenu();
},
init() {
Services.prefs.addObserver('zen.tabs.vertical.right-side', this._updateSidebarIsOnRight.bind(this));
gZenUIManager.addPopupTrackingAttribute(this.sidebar);
gZenUIManager.addPopupTrackingAttribute(document.getElementById('zen-appcontent-navbar-container'));
this.addMouseActions();
this.addContextMenu();
// Clear hover states when window state changes (minimize, maximize, etc.)
window.addEventListener('sizemodechange', () => this._clearAllHoverStates());
@@ -47,6 +55,9 @@ var gZenCompactModeManager = {
buttons.removeAttribute('zen-has-hover');
});
}
this.preference = this._wasInCompactMode;
delete this._wasInCompactMode;
},
get preference() {