diff --git a/app/assets/javascripts/top_menu.js b/app/assets/javascripts/top_menu.js index 87f4222799..a1345badca 100644 --- a/app/assets/javascripts/top_menu.js +++ b/app/assets/javascripts/top_menu.js @@ -43,6 +43,11 @@ this.setupDropdownHoverAndClick(); this.registerEventHandlers(); this.closeOnBodyClick(); + this.accessibility(); + }, + + accessibility: function () { + $(".drop-down > ul").attr("aria-expanded","false"); }, toggleClick: function (dropdown) { @@ -183,13 +188,13 @@ slideDown: function (dropdown) { var toDrop = dropdown.find("> ul"); dropdown.addClass("open"); - toDrop.slideDown(animationRate); + toDrop.slideDown(animationRate).attr("aria-expanded","true"); }, slideUp: function (dropdown) { var toDrop = $(dropdown).find("> ul"); dropdown.removeClass("open"); - toDrop.slideUp(animationRate); + toDrop.slideUp(animationRate).attr("aria-expanded","false"); }, // If there is ANY input, it will have precedence over links, diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb index 50cf61d78e..fae94cc7ec 100644 --- a/lib/redmine/menu_manager/top_menu_helper.rb +++ b/lib/redmine/menu_manager/top_menu_helper.rb @@ -56,7 +56,8 @@ module Redmine::MenuManager::TopMenuHelper action: 'index' }, title: l(:label_project_plural), accesskey: OpenProject::AccessKeys.key_for(:project_search), - class: 'icon5 icon-projects' + class: 'icon5 icon-projects', + aria: { haspopup: 'true' } if User.current.impaired? result = content_tag :li do @@ -132,7 +133,7 @@ module Redmine::MenuManager::TopMenuHelper end def render_user_drop_down(items) - render_drop_down_menu_node link_to_user(User.current, title: User.current.to_s), + render_drop_down_menu_node link_to_user(User.current, title: User.current.to_s, aria: { haspopup: 'true' }), items, class: 'drop-down last-child' end @@ -149,7 +150,7 @@ module Redmine::MenuManager::TopMenuHelper end def render_module_top_menu_node(items = more_top_menu_items) - render_drop_down_menu_node link_to(l(:label_modules), '#', title: l(:label_modules), class: 'icon5 icon-modules'), + render_drop_down_menu_node link_to(l(:label_modules), '#', title: l(:label_modules), class: 'icon5 icon-modules', aria: { haspopup: 'true' }), items, id: 'more-menu' end