Skip to content

Commit

Permalink
fix(component): megamenu accessibility
Browse files Browse the repository at this point in the history
role application for keyboard management
role presentation on nav-items
  • Loading branch information
ygatesoupe committed Feb 6, 2017
1 parent ef0eb5d commit 67f74cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs-orange/examples/orange-news/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@
</div>
</nav>

<nav class="navbar navbar-toggleable-md navbar-inverse" role="navigation">
<nav class="navbar navbar-toggleable-md navbar-inverse" role="navigation">
<div class="container" >
<a class="navbar-brand" href>
<img src="dist/img/ORANGE_LOGO_rgb.jpg" alt="Back to homepage" title="Go to homepage"/>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbarHead">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbarHead">
<span class="sr-only">toggle navigation</span>
<span class="icon-menu"></span>
</button>
Expand Down
5 changes: 4 additions & 1 deletion js/src/o-megamenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const MegaMenu = (($) => {
MEGAMENU_PANEL_NAV : '.mega-menu-panel > .container > .navbar-nav',
MEGAMENU_NAV : '.nav-link + .navbar-nav',
NAV_MENU : '.navbar-nav',
NAV_ITEM : '.nav-item',
NAV_LINK : '.nav-link',
NAV_LINK_COLLAPSE : '.nav-link[data-toggle=collapse]',
NAV_LINK_BACK : '.nav-link.back',
Expand Down Expand Up @@ -87,10 +88,12 @@ const MegaMenu = (($) => {
_addAriaAttributes(element) {
const $subNavs = $(element).find('.nav-link + .navbar-nav')

$(element).attr('role', 'menu')
$(element).attr('role', 'application')
$(element).find('> .navbar-nav').attr('role', 'menu')
$(element).find(Selector.MEGAMENU_PANEL).attr('role', 'menu')
$(element).find('.nav-link[data-toggle=collapse]').attr('role', 'menuitem')
$(element).find(Selector.NAV_LINK_BACK).attr({'aria-hidden': true, 'tabindex': -1})
$(element).find(Selector.NAV_ITEM).attr('role', 'presentation')

$subNavs.each(function() {
const navId = Util.getUID(NAME)
Expand Down

0 comments on commit 67f74cb

Please sign in to comment.