vendor/uui/js/u-ui.js
function (evt) {
        if (this.element && this._container) {
            var items = this.element.querySelectorAll('.u-menu-item:not([disabled])');

            if (items && items.length > 0 && u.hasClass(this._container, 'is-visible')) {
                var currentIndex = Array.prototype.slice.call(items).indexOf(evt.target);

                if (evt.keyCode === this._Keycodes.UP_ARROW) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    if (currentIndex > 0) {
                        items[currentIndex - 1].focus();
                    } else {
                        items[items.length - 1].focus();
                    }
                } else if (evt.keyCode === this._Keycodes.DOWN_ARROW) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    if (items.length > currentIndex + 1) {
                        items[currentIndex + 1].focus();
                    } else {
                        items[0].focus();
                    }
                } else if (evt.keyCode === this._Keycodes.SPACE ||
                    evt.keyCode === this._Keycodes.ENTER) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    // Send mousedown and mouseup to trigger ripple.
                    var e = new MouseEvent('mousedown');
                    evt.target.dispatchEvent(e);
                    e = new MouseEvent('mouseup');
                    evt.target.dispatchEvent(e);
                    // Send click.
                    evt.target.click();
                } else if (evt.keyCode === this._Keycodes.ESCAPE) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    this.hide();
                }
            }
        }
    }
function (evt) {
        if (this.element && this._container) {
            var items = this.element.querySelectorAll('.u-menu-item:not([disabled])');

            if (items && items.length > 0 && u.hasClass(this._container, 'is-visible')) {
                var currentIndex = Array.prototype.slice.call(items).indexOf(evt.target);

                if (evt.keyCode === this._Keycodes.UP_ARROW) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    if (currentIndex > 0) {
                        items[currentIndex - 1].focus();
                    } else {
                        items[items.length - 1].focus();
                    }
                } else if (evt.keyCode === this._Keycodes.DOWN_ARROW) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    if (items.length > currentIndex + 1) {
                        items[currentIndex + 1].focus();
                    } else {
                        items[0].focus();
                    }
                } else if (evt.keyCode === this._Keycodes.SPACE ||
                    evt.keyCode === this._Keycodes.ENTER) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    // Send mousedown and mouseup to trigger ripple.
                    var e = new MouseEvent('mousedown');
                    evt.target.dispatchEvent(e);
                    e = new MouseEvent('mouseup');
                    evt.target.dispatchEvent(e);
                    // Send click.
                    evt.target.click();
                } else if (evt.keyCode === this._Keycodes.ESCAPE) {
                    u.stopEvent(evt);
                    // evt.preventDefault();
                    this.hide();
                }
            }
        }
    }
function ( evt ) { if ( this . element && this . _container ) { var items = this . element . querySelectorAll ( '.u-menu-item:not([disabled])' ) ; if ( items && items . length > 0 && u . hasClass ( this . _container , 'is-visible' ) ) { var currentIndex = Array . prototype . slice . call ( items ) . indexOf ( evt . target ) ; if ( evt . keyCode === this . _Keycodes . UP_ARROW ) { u . stopEvent ( evt ) ; // evt.preventDefault(); if ( currentIndex > 0 ) { items [ currentIndex - 1 ] . focus ( ) ; } else { items [ items . length - 1 ] . focus ( ) ; } } else if ( evt . keyCode === this . _Keycodes . DOWN_ARROW ) { u . stopEvent ( evt ) ; // evt.preventDefault(); if ( items . length > currentIndex + 1 ) { items [ currentIndex + 1 ] . focus ( ) ; } else { items [ 0 ] . focus ( ) ; } } else if ( evt . keyCode === this . _Keycodes . SPACE || evt . keyCode === this . _Keycodes . ENTER ) { u . stopEvent ( evt ) ; // evt.preventDefault(); // Send mousedown and mouseup to trigger ripple. var e = new MouseEvent ( 'mousedown' ) ; evt . target . dispatchEvent ( e ) ; e = new MouseEvent ( 'mouseup' ) ; evt . target . dispatchEvent ( e ) ; // Send click. evt . target . click ( ) ; } else if ( evt . keyCode === this . _Keycodes . ESCAPE ) { u . stopEvent ( evt ) ; // evt.preventDefault(); this . hide ( ) ; } } } }
Handles a keyboard event on an item.

@param {Event} evt The event that fired.
@private
Handles a keyboard event on an item .