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

Fix toggler not being focussable and access with enter

Oliver Güntherf71b3044985a
diff --git a/frontend/src/global_styles/layout/_main_menu.sass b/frontend/src/global_styles/layout/_main_menu.sass
index 56289a70f40..1b1f1b74d6b 100644
--- a/frontend/src/global_styles/layout/_main_menu.sass
+++ b/frontend/src/global_styles/layout/_main_menu.sass
@@ -398,6 +398,12 @@ $badge_offset: 4px
font-weight: bold
font-style: italic
+.main-menu-toggler
+ background: transparent
+ color: var(--main-menu-font-color)
+ border: none
+
+
#main-menu-toggle
.spot-icon_close
display: none
diff --git a/lib/redmine/menu_manager/menu_helper.rb b/lib/redmine/menu_manager/menu_helper.rb
index e00e943195a..78209d27f7c 100644
--- a/lib/redmine/menu_manager/menu_helper.rb
+++ b/lib/redmine/menu_manager/menu_helper.rb
@@ -168,7 +168,10 @@ module Redmine::MenuManager::MenuHelper
end
def render_menu_toggler
- content_tag(:a, class: 'toggler', data: { action: 'menus--main#descend' }) do
+ content_tag(:button,
+ class: 'toggler main-menu-toggler',
+ type: :button,
+ data: { action: 'menus--main#descend' }) do
spot_icon('arrow-right3', size: '1')
end
end
diff --git a/spec/lib/redmine/menu_manager/menu_helper_spec.rb b/spec/lib/redmine/menu_manager/menu_helper_spec.rb
index 03efa73ad05..95f75f5e8e6 100644
--- a/spec/lib/redmine/menu_manager/menu_helper_spec.rb
+++ b/spec/lib/redmine/menu_manager/menu_helper_spec.rb
@@ -110,9 +110,9 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
<span class="ellipsis">Parent node</span>
</span>
</a>
- <a class="toggler" data-action="menus--main#descend">
+ <button class="toggler main-menu-toggler" type="button" data-action="menus--main#descend">
<span class="spot-icon spot-icon_1 spot-icon_arrow-right3"></span>
- </a>
+ </button>
</div>
<div class="main-menu--children-menu-header">
<a title="Up" class="main-menu--arrow-left-to-project" data-action="menus--main#ascend">
@@ -201,9 +201,9 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
<span class="ellipsis">Parent node</span>
</span>
</a>
- <a class="toggler" data-action="menus--main#descend">
+ <button class="toggler main-menu-toggler" type="button" data-action="menus--main#descend">
<span class="spot-icon spot-icon_1 spot-icon_arrow-right3"></span>
- </a>
+ </button>
</div>
<div class="main-menu--children-menu-header">
<a title="Up" class="main-menu--arrow-left-to-project"
@@ -274,9 +274,9 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
<span class="ellipsis">Parent node</span>
</span>
</a>
- <a class="toggler" data-action="menus--main#descend">
+ <button class="toggler main-menu-toggler" type="button" data-action="menus--main#descend">
<span class="spot-icon spot-icon_1 spot-icon_arrow-right3"></span>
- </a>
+ </button>
</div>
<div class="main-menu--children-menu-header">
<a title="Up" class="main-menu--arrow-left-to-project" data-action="menus--main#ascend">
@@ -294,9 +294,9 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
<span class="ellipsis">Child node</span>
</span>
</a>
- <a class="toggler" data-action="menus--main#descend">
+ <button class="toggler main-menu-toggler" type="button" data-action="menus--main#descend">
<span class="spot-icon spot-icon_1 spot-icon_arrow-right3"></span>
- </a>
+ </button>
</div>
<div class="main-menu--children-menu-header">
<a title="Up" class="main-menu--arrow-left-to-project" data-action="menus--main#ascend">