function addKeydownHandlersToMenu() {
        var menu = angular.element($elm[0].querySelector('.ui-grid-menu-items'))[0],
          menuItems,
          visibleMenuItems = [];

        if (menu) {
          menu.onkeydown = function closeMenu(event) {
            if (event.keyCode === uiGridConstants.keymap.ESC) {
              event.preventDefault();
              $scope.hideMenu();
            }
          };

          menuItems = menu.querySelectorAll('.ui-grid-menu-item:not(.ng-hide)');
          angular.forEach(menuItems, function filterVisibleItems(item) {
            if (item.offsetParent !== null) {
              this.push(item);
            }
          }, visibleMenuItems);

          if (visibleMenuItems.length) {
            if (visibleMenuItems.length === 1) {
              visibleMenuItems[0].onkeydown = function singleItemHandler(event) {
                circularFocusHandler(event, true);
              };
            } else {
              visibleMenuItems[0].onkeydown = function firstItemHandler(event) {
                circularFocusHandler(event, false, event.shiftKey, visibleMenuItems.length - 1);
              };
              visibleMenuItems[visibleMenuItems.length - 1].onkeydown = function lastItemHandler(event) {
                circularFocusHandler(event, false, !event.shiftKey, 0);
              };
            }
          }
        }

        function circularFocusHandler(event, isSingleItem, shiftKeyStatus, index) {
          if (event.keyCode === uiGridConstants.keymap.TAB) {
            if (isSingleItem) {
              event.preventDefault();
            } else if (shiftKeyStatus) {
              event.preventDefault();
              visibleMenuItems[index].focus();
            }
          }
        }
      }
@ngdoc method
@methodOf ui.grid.directive:uiGridColumnMenu
@name hideMenu
@description Hides the column menu.
@param {boolean} broadcastTrigger true if we were triggered by a broadcast
from the menu itself - in which case don't broadcast again as we'll get
an infinite loop