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

[64294] Focus is not on back arrow when navigating through main menu (#19368)

Behrokh Satarnejadbc8e1a347bef
diff --git a/frontend/src/stimulus/controllers/dynamic/menus/main.controller.ts b/frontend/src/stimulus/controllers/dynamic/menus/main.controller.ts
index 71bad92c5f4..76ff12d29aa 100644
--- a/frontend/src/stimulus/controllers/dynamic/menus/main.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/menus/main.controller.ts
@@ -33,6 +33,8 @@ export default class MainMenuController extends Controller {
targetLi.querySelector<HTMLElement>('li > a, .tree-menu--title')?.focus();
+ const backArrow = targetLi.querySelector('.main-menu--arrow-left-to-project') as HTMLElement;
+ backArrow.focus();
this.markActive(targetLi.dataset.name as string);
}
diff --git a/lib/redmine/menu_manager/menu_helper.rb b/lib/redmine/menu_manager/menu_helper.rb
index dbb30703b60..adc1ac9f675 100644
--- a/lib/redmine/menu_manager/menu_helper.rb
+++ b/lib/redmine/menu_manager/menu_helper.rb
@@ -216,10 +216,11 @@ module Redmine::MenuManager::MenuHelper
:a,
render(Primer::Beta::Octicon.new("arrow-left", size: :small)),
href: "#",
+ tabindex: "0",
"aria-label": I18n.t(:label_go_back),
class: "main-menu--arrow-left-to-project",
data: {
- action: "menus--main#ascend",
+ action: "menus--main#ascend keydown.enter->menus--main#ascend",
"tour-selector": "main-menu--arrow-left_#{node.name}",
"test-selector": "main-menu--arrow-left-to-project"
}
diff --git a/spec/lib/redmine/menu_manager/menu_helper_spec.rb b/spec/lib/redmine/menu_manager/menu_helper_spec.rb
index 07dcc65b511..4fcc0337f8e 100644
--- a/spec/lib/redmine/menu_manager/menu_helper_spec.rb
+++ b/spec/lib/redmine/menu_manager/menu_helper_spec.rb
@@ -132,7 +132,7 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
</button>
</div>
<div class="main-menu--children-menu-header">
- <a class="main-menu--arrow-left-to-project" data-action="menus--main#ascend" data-tour-selector="main-menu--arrow-left_parent_node" data-test-selector="main-menu--arrow-left-to-project" href="#" aria-label="Go back one menu level">
+ <a class="main-menu--arrow-left-to-project" data-action="menus--main#ascend keydown.enter-&gt;menus--main#ascend" data-tour-selector="main-menu--arrow-left_parent_node" data-test-selector="main-menu--arrow-left-to-project" href="#" aria-label="Go back one menu level" tabindex="0">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-arrow-left">
<path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path>
</svg>
@@ -228,10 +228,10 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
</div>
<div class="main-menu--children-menu-header">
<a class="main-menu--arrow-left-to-project"
- data-action="menus--main#ascend"
+ data-action="menus--main#ascend keydown.enter-&gt;menus--main#ascend"
data-tour-selector="main-menu--arrow-left_parent_node"
data-test-selector="main-menu--arrow-left-to-project"
- href="#" aria-label="Go back one menu level">
+ href="#" aria-label="Go back one menu level" tabindex="0">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-arrow-left">
<path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path>
</svg>
@@ -307,7 +307,7 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
</button>
</div>
<div class="main-menu--children-menu-header">
- <a class="main-menu--arrow-left-to-project" data-action="menus--main#ascend" data-tour-selector="main-menu--arrow-left_parent_node" data-test-selector="main-menu--arrow-left-to-project" href="#" aria-label="Go back one menu level">
+ <a class="main-menu--arrow-left-to-project" data-action="menus--main#ascend keydown.enter-&gt;menus--main#ascend" data-tour-selector="main-menu--arrow-left_parent_node" data-test-selector="main-menu--arrow-left-to-project" href="#" aria-label="Go back one menu level" tabindex="0">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-arrow-left">
<path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path>
</svg>
@@ -331,7 +331,7 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
</button>
</div>
<div class="main-menu--children-menu-header">
- <a class="main-menu--arrow-left-to-project" data-action="menus--main#ascend" data-tour-selector="main-menu--arrow-left_child_node" href="#" aria-label="Go back one menu level" data-test-selector="main-menu--arrow-left-to-project" >
+ <a class="main-menu--arrow-left-to-project" data-action="menus--main#ascend keydown.enter-&gt;menus--main#ascend" data-tour-selector="main-menu--arrow-left_child_node" href="#" aria-label="Go back one menu level" data-test-selector="main-menu--arrow-left-to-project" tabindex="0">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-arrow-left">
<path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path>
</svg>
@@ -350,9 +350,9 @@ RSpec.describe Redmine::MenuManager::MenuHelper, type: :helper do
</ul>
<div class="main-menu--children-menu-header">
<a class="main-menu--arrow-left-to-project"
- data-action="menus--main#ascend"
+ data-action="menus--main#ascend keydown.enter-&gt;menus--main#ascend"
data-tour-selector="main-menu--arrow-left_parent_node"
- data-test-selector="main-menu--arrow-left-to-project" href="#" aria-label="Go back one menu level">
+ data-test-selector="main-menu--arrow-left-to-project" href="#" aria-label="Go back one menu level" tabindex="0">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-arrow-left">
<path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path>
</svg>