From 9933ab4829daf5bcaffbf7efd84d4132f902c75f Mon Sep 17 00:00:00 2001 From: Inga Mai Date: Fri, 17 Apr 2020 19:01:02 +0200 Subject: [PATCH] Fix main menu flickering after reload by setting correct init value of width --- app/views/layouts/base.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 5c02a12d2f..7fb9ba55c6 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -204,15 +204,17 @@ See docs/COPYRIGHT.rdoc for more details. (function($) { var wrapper = $('#wrapper'); var savedMainMenuWidth = window.OpenProject.guardedLocalStorage("openProject-mainMenuWidth"); + var mainMenuCollapsed = window.OpenProject.guardedLocalStorage("openProject-mainMenuCollapsed"); if (window.innerWidth < 680) { // force hide on load for mobile $('.can-hide-navigation').addClass('hidden-navigation'); } - if (savedMainMenuWidth) { - document.documentElement.style.setProperty("--main-menu-width", savedMainMenuWidth + 'px'); + if (mainMenuCollapsed === 'true') { + savedMainMenuWidth = 0; } + document.documentElement.style.setProperty("--main-menu-width", savedMainMenuWidth + 'px'); wrapper.show();