Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

The wrapper is initially hidden to avoid a flickering in the sidebar. This, of course only has to be done when there is actually a sidebar. Otherwise we get focus issue for example on the login page (see #41929)

Henriette Darge1eac3d1eee95
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index cc5061040e4..2e92e31e9c2 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -449,8 +449,8 @@ module ApplicationHelper
# To avoid the menu flickering, disable it
# by default unless we're in test mode
- def initial_menu_styles
- Rails.env.test? ? '' : 'display:none'
+ def initial_menu_styles(side_displayed)
+ Rails.env.test? || !side_displayed ? '' : 'display:none'
end
def initial_menu_classes(side_displayed, show_decoration)
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb
index da02f489d5d..a8406c0a3ed 100644
--- a/app/views/layouts/base.html.erb
+++ b/app/views/layouts/base.html.erb
@@ -57,7 +57,7 @@ See COPYRIGHT and LICENSE files for more details.
<% main_menu = render_main_menu(local_assigns.fetch(:menu_name, nil), @project) %>
<% side_displayed = content_for?(:sidebar) || content_for?(:main_menu) || !main_menu.blank? %>
<% initial_classes = initial_menu_classes(side_displayed, show_decoration) %>
-<div id="wrapper" style="<%= initial_menu_styles %>" class="<%= initial_classes %>">
+<div id="wrapper" style="<%= initial_menu_styles(side_displayed) %>" class="<%= initial_classes %>">
<% if show_decoration %>
<header class="op-app-header">
<div class="op-app-header--start">