dist/toolkit.js
function(e) {
        var items = this.items,
            length = Math.min(this.options.itemLimit, Math.max(0, items.length)),
            event = 'cycle';

        if (!length || !this.element.is(':shown')) {
            return;
        }

        switch (e.keyCode) {
            // Cycle upwards (up)
            case 38:
                this.index -= (items[this.index - 1] ? 1 : 2); // category check

                if (this.index < 0) {
                    this.index = length;
                }
            break;

            // Cycle downwards (down)
            case 40:
                this.index += (items[this.index + 1] ? 1 : 2); // category check

                if (this.index >= length) {
                    this.index = -1;
                }
            break;

            // Select first (tab)
            case 9:
                e.preventDefault();

                var i = 0;

                while (!this.items[i]) {
                    i++;
                }

                event = 'select';
                this.index = i;
                this.hide();
            break;

            // Select current index (enter)
            case 13:
                e.preventDefault();

                event = 'select';
                this.hide();
            break;

            // Reset (esc)
            case 27:
                this.index = -1;
                this.hide();
            break;

            // Cancel others
            default:
            return;
        }

        if (this.shadow) {
            this.shadow.val('');
        }

        // Select the item
        this.select(this.index, event);
    }
function(e) {
        var items = this.items,
            length = Math.min(this.options.itemLimit, Math.max(0, items.length)),
            event = 'cycle';

        if (!length || !this.element.is(':shown')) {
            return;
        }

        switch (e.keyCode) {
            // Cycle upwards (up)
            case 38:
                this.index -= (items[this.index - 1] ? 1 : 2); // category check

                if (this.index < 0) {
                    this.index = length;
                }
            break;

            // Cycle downwards (down)
            case 40:
                this.index += (items[this.index + 1] ? 1 : 2); // category check

                if (this.index >= length) {
                    this.index = -1;
                }
            break;

            // Select first (tab)
            case 9:
                e.preventDefault();

                var i = 0;

                while (!this.items[i]) {
                    i++;
                }

                event = 'select';
                this.index = i;
                this.hide();
            break;

            // Select current index (enter)
            case 13:
                e.preventDefault();

                event = 'select';
                this.hide();
            break;

            // Reset (esc)
            case 27:
                this.index = -1;
                this.hide();
            break;

            // Cancel others
            default:
            return;
        }

        if (this.shadow) {
            this.shadow.val('');
        }

        // Select the item
        this.select(this.index, event);
    }
function ( e ) { var items = this . items , length = Math . min ( this . options . itemLimit , Math . max ( 0 , items . length ) ) , event = 'cycle' ; if ( ! length || ! this . element . is ( ':shown' ) ) { return ; } switch ( e . keyCode ) { // Cycle upwards (up) case 38 : this . index -= ( items [ this . index - 1 ] ? 1 : 2 ) ; // category check if ( this . index < 0 ) { this . index = length ; } break ; // Cycle downwards (down) case 40 : this . index += ( items [ this . index + 1 ] ? 1 : 2 ) ; // category check if ( this . index >= length ) { this . index = - 1 ; } break ; // Select first (tab) case 9 : e . preventDefault ( ) ; var i = 0 ; while ( ! this . items [ i ] ) { i ++ ; } event = 'select' ; this . index = i ; this . hide ( ) ; break ; // Select current index (enter) case 13 : e . preventDefault ( ) ; event = 'select' ; this . hide ( ) ; break ; // Reset (esc) case 27 : this . index = - 1 ; this . hide ( ) ; break ; // Cancel others default : return ; } if ( this . shadow ) { this . shadow . val ( '' ) ; } // Select the item this . select ( this . index , event ) ; }
Cycle through the items in the list when an arrow key, esc or enter is released.

@private
@param {jQuery.Event} e
Cycle through the items in the list when an arrow key esc or enter is released .