Permalink
Browse files

Fixed bug with keyboard (last and first subnavs)

- Fixed #2 (bug when you hit "right" in the first submenu, same when you hit left on last submenu) (close #2)
- Fixed another bug : when you hit "right" in the first submenu, the last element of last submenu was selected, instead of first one.
  • Loading branch information...
nico3333fr committed Mar 27, 2016
1 parent 0e00fc6 commit 02ac9e2d76447b14e0ec48d45684f4e7eaa9145d
Showing with 2 additions and 2 deletions.
  1. +2 −2 jquery-accessible-subnav-dropdown.js
@@ -149,7 +149,7 @@ $(document).ready(function(){
$subnav_item = $this.parents('.js-nav-system__subnav__item'),
$nav_link = $subnav.prev('.js-nav-system__link'),
$nav_item = $nav_link.parents('.js-nav-system__item'),
$nav = $nav_link.parents('.js-nav-system__item');
$nav = $nav_link.parents('.js-nav-system');

// event keyboard bottom
if ( event.keyCode == 40 ) {
@@ -224,7 +224,7 @@ $(document).ready(function(){
$prev.focus();
$subnav_prev = $prev.next('.js-nav-system__subnav');
if ($subnav_prev.length === 1){
$subnav_prev.find( ".js-nav-system__subnav__item:last-child ").children( ".js-nav-system__subnav__link" ).focus();
$subnav_prev.find( ".js-nav-system__subnav__item:first-child ").children( ".js-nav-system__subnav__link" ).focus();
}
}
// else activate prev

0 comments on commit 02ac9e2

Please sign in to comment.