code: function onMenuKeyDown(ev) {
            var handled;
            switch (ev.keyCode) {
              case $mdConstant.KEY_CODE.ESCAPE:
                opts.mdMenuCtrl.close(false, { closeAll: true });
                handled = true;
                break;
              case $mdConstant.KEY_CODE.TAB:
                opts.mdMenuCtrl.close(false, { closeAll: true });
                // Don't prevent default or stop propagation on this event as we want tab
                // to move the focus to the next focusable element on the page.
                handled = false;
                break;
              case $mdConstant.KEY_CODE.UP_ARROW:
                if (!focusMenuItem(ev, opts.menuContentEl, opts, -1) && !opts.nestLevel) {
                  opts.mdMenuCtrl.triggerContainerProxy(ev);
                }
                handled = true;
                break;
              case $mdConstant.KEY_CODE.DOWN_ARROW:
                if (!focusMenuItem(ev, opts.menuContentEl, opts, 1) && !opts.nestLevel) {
                  opts.mdMenuCtrl.triggerContainerProxy(ev);
                }
                handled = true;
                break;
              case $mdConstant.KEY_CODE.LEFT_ARROW:
                if (opts.nestLevel) {
                  opts.mdMenuCtrl.close();
                } else {
                  opts.mdMenuCtrl.triggerContainerProxy(ev);
                }
                handled = true;
                break;
              case $mdConstant.KEY_CODE.RIGHT_ARROW:
                var parentMenu = $mdUtil.getClosest(ev.target, 'MD-MENU');
                if (parentMenu && parentMenu != opts.parent[0]) {
                  ev.target.click();
                } else {
                  opts.mdMenuCtrl.triggerContainerProxy(ev);
                }
                handled = true;
                break;
            }
            if (handled) {
              ev.preventDefault();
              ev.stopImmediatePropagation();
            }
          }
docs: ************************************ internal functions ************************************