Add aria-haspopup and aria-expanded attributes to topmenu

pull/3948/head
Magdalena Kafka 9 years ago committed by Oliver Günther
parent 7f53d504d0
commit 3befaa8ca4
  1. 9
      app/assets/javascripts/top_menu.js
  2. 7
      lib/redmine/menu_manager/top_menu_helper.rb

@ -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,

@ -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

Loading…
Cancel
Save