src/utils/DropdownEventHandler.js
function _keydownHook(event) {
            var keyCode;

            // (page) up, (page) down, enter and tab key are handled by the list
            if (event.type === "keydown") {
                keyCode = event.keyCode;

                if (keyCode === KeyEvent.DOM_VK_TAB) {
                    self.close();
                } else if (keyCode === KeyEvent.DOM_VK_UP) {
                    // Move up one, wrapping at edges (if nothing selected, select the last item)
                    self._tryToSelect(self._selectedIndex === -1 ? -1 : self._selectedIndex - 1, -1);
                } else if (keyCode === KeyEvent.DOM_VK_DOWN) {
                    // Move down one, wrapping at edges (if nothing selected, select the first item)
                    self._tryToSelect(self._selectedIndex === -1 ? 0 : self._selectedIndex + 1, +1);
                } else if (keyCode === KeyEvent.DOM_VK_PAGE_UP) {
                    // Move up roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the first item)
                    self._tryToSelect((self._selectedIndex || 0) - self._itemsPerPage(), -1, true);
                } else if (keyCode === KeyEvent.DOM_VK_PAGE_DOWN) {
                    // Move down roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the item one page down from the top)
                    self._tryToSelect((self._selectedIndex || 0) + self._itemsPerPage(), +1, true);

                } else if (keyCode === KeyEvent.DOM_VK_HOME) {
                    self._tryToSelect(0, +1);
                } else if (keyCode === KeyEvent.DOM_VK_END) {
                    self._tryToSelect(self.$items.length - 1, -1);

                } else if (self._selectedIndex !== -1 &&
                        (keyCode === KeyEvent.DOM_VK_RETURN)) {

                    // Trigger a click handler to commmit the selected item
                    self._selectionHandler();
                } else {
                    // Let the event bubble.
                    return false;
                }

                event.stopImmediatePropagation();
                event.preventDefault();
                return true;
            }

            // If we didn't handle it, let other global keydown hooks handle it.
            return false;
        }
function _keydownHook(event) {
            var keyCode;

            // (page) up, (page) down, enter and tab key are handled by the list
            if (event.type === "keydown") {
                keyCode = event.keyCode;

                if (keyCode === KeyEvent.DOM_VK_TAB) {
                    self.close();
                } else if (keyCode === KeyEvent.DOM_VK_UP) {
                    // Move up one, wrapping at edges (if nothing selected, select the last item)
                    self._tryToSelect(self._selectedIndex === -1 ? -1 : self._selectedIndex - 1, -1);
                } else if (keyCode === KeyEvent.DOM_VK_DOWN) {
                    // Move down one, wrapping at edges (if nothing selected, select the first item)
                    self._tryToSelect(self._selectedIndex === -1 ? 0 : self._selectedIndex + 1, +1);
                } else if (keyCode === KeyEvent.DOM_VK_PAGE_UP) {
                    // Move up roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the first item)
                    self._tryToSelect((self._selectedIndex || 0) - self._itemsPerPage(), -1, true);
                } else if (keyCode === KeyEvent.DOM_VK_PAGE_DOWN) {
                    // Move down roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the item one page down from the top)
                    self._tryToSelect((self._selectedIndex || 0) + self._itemsPerPage(), +1, true);

                } else if (keyCode === KeyEvent.DOM_VK_HOME) {
                    self._tryToSelect(0, +1);
                } else if (keyCode === KeyEvent.DOM_VK_END) {
                    self._tryToSelect(self.$items.length - 1, -1);

                } else if (self._selectedIndex !== -1 &&
                        (keyCode === KeyEvent.DOM_VK_RETURN)) {

                    // Trigger a click handler to commmit the selected item
                    self._selectionHandler();
                } else {
                    // Let the event bubble.
                    return false;
                }

                event.stopImmediatePropagation();
                event.preventDefault();
                return true;
            }

            // If we didn't handle it, let other global keydown hooks handle it.
            return false;
        }
function _keydownHook ( event ) { var keyCode ; // (page) up, (page) down, enter and tab key are handled by the list if ( event . type === "keydown" ) { keyCode = event . keyCode ; if ( keyCode === KeyEvent . DOM_VK_TAB ) { self . close ( ) ; } else if ( keyCode === KeyEvent . DOM_VK_UP ) { // Move up one, wrapping at edges (if nothing selected, select the last item) self . _tryToSelect ( self . _selectedIndex === - 1 ? - 1 : self . _selectedIndex - 1 , - 1 ) ; } else if ( keyCode === KeyEvent . DOM_VK_DOWN ) { // Move down one, wrapping at edges (if nothing selected, select the first item) self . _tryToSelect ( self . _selectedIndex === - 1 ? 0 : self . _selectedIndex + 1 , + 1 ) ; } else if ( keyCode === KeyEvent . DOM_VK_PAGE_UP ) { // Move up roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the first item) self . _tryToSelect ( ( self . _selectedIndex || 0 ) - self . _itemsPerPage ( ) , - 1 , true ) ; } else if ( keyCode === KeyEvent . DOM_VK_PAGE_DOWN ) { // Move down roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the item one page down from the top) self . _tryToSelect ( ( self . _selectedIndex || 0 ) + self . _itemsPerPage ( ) , + 1 , true ) ; } else if ( keyCode === KeyEvent . DOM_VK_HOME ) { self . _tryToSelect ( 0 , + 1 ) ; } else if ( keyCode === KeyEvent . DOM_VK_END ) { self . _tryToSelect ( self . $items . length - 1 , - 1 ) ; } else if ( self . _selectedIndex !== - 1 && ( keyCode === KeyEvent . DOM_VK_RETURN ) ) { // Trigger a click handler to commmit the selected item self . _selectionHandler ( ) ; } else { // Let the event bubble. return false ; } event . stopImmediatePropagation ( ) ; event . preventDefault ( ) ; return true ; } // If we didn't handle it, let other global keydown hooks handle it. return false ; }
Convert keydown events into hint list navigation actions.

@param {KeyboardEvent} event
@return {boolean} true if key was handled, otherwise false.
Convert keydown events into hint list navigation actions .