function focusMenuItem(e, menuEl, opts, direction) {
      var currentItem = $mdUtil.getClosest(e.target, 'MD-MENU-ITEM');

      var items = $mdUtil.nodesToArray(menuEl[0].children);
      var currentIndex = items.indexOf(currentItem);

      // Traverse through our elements in the specified direction (+/-1) and try to
      // focus them until we find one that accepts focus
      var didFocus;
      for (var i = currentIndex + direction; i >= 0 && i < items.length; i = i + direction) {
        var focusTarget = items[i].querySelector('.md-button');
        didFocus = attemptFocus(focusTarget);
        if (didFocus) {
          break;
        }
      }
      return didFocus;
    }
function focusMenuItem(e, menuEl, opts, direction) {
      var currentItem = $mdUtil.getClosest(e.target, 'MD-MENU-ITEM');

      var items = $mdUtil.nodesToArray(menuEl[0].children);
      var currentIndex = items.indexOf(currentItem);

      // Traverse through our elements in the specified direction (+/-1) and try to
      // focus them until we find one that accepts focus
      var didFocus;
      for (var i = currentIndex + direction; i >= 0 && i < items.length; i = i + direction) {
        var focusTarget = items[i].querySelector('.md-button');
        didFocus = attemptFocus(focusTarget);
        if (didFocus) {
          break;
        }
      }
      return didFocus;
    }
function focusMenuItem ( e , menuEl , opts , direction ) { var currentItem = $mdUtil . getClosest ( e . target , 'MD-MENU-ITEM' ) ; var items = $mdUtil . nodesToArray ( menuEl [ 0 ] . children ) ; var currentIndex = items . indexOf ( currentItem ) ; // Traverse through our elements in the specified direction (+/-1) and try to // focus them until we find one that accepts focus var didFocus ; for ( var i = currentIndex + direction ; i >= 0 && i < items . length ; i = i + direction ) { var focusTarget = items [ i ] . querySelector ( '.md-button' ) ; didFocus = attemptFocus ( focusTarget ) ; if ( didFocus ) { break ; } } return didFocus ; }
Takes a keypress event and focuses the next/previous menu
item from the emitting element
@param {event} e - The origin keypress event
@param {angular.element} menuEl - The menu element
@param {object} opts - The interim element options for the mdMenu
@param {number} direction - The direction to move in (+1 = next, -1 = prev)
Takes a keypress event and focuses the next / previous menu item from the emitting element
Focuses the specified menu item