src/aria/widgets/form/list/ListController.js
function (evtInfo) {

            var data = this._data;

            var evt = {
                name : "keyevent",
                charCode : evtInfo.charCode,
                keyCode : evtInfo.keyCode,
                focusIndex : data.focusIndex,
                cancelDefault : false
            };

            this.$raiseEvent(evt);

            if (data && !evt.cancelDefault) {

                var moveFocus, itemsView = data.itemsView;
                if (ariaDomEvent.isNavigationKey(evt.keyCode)) {
                    this._navigationEvent = true;
                    var startIndex = data.multipleSelect ? data.focusIndex : data.selectedIndex > -1 ? itemsView.getNewIndex(itemsView.items, data.selectedIndex) : data.selectedIndex, isFocusable = false, oldFocus = startIndex;
                    moveFocus = startIndex;
                    while (!isFocusable) {
                        moveFocus = this.calcMoveFocus(data.displayOptions.flowOrientation, moveFocus, data.numberOfRows, data.numberOfColumns, evt.keyCode, data.itemsView.items.length);
                        if (oldFocus == moveFocus) {
                            // Tried to move on to a disabled box that cannot be skipped because it's on the edge of
                            // the container
                            moveFocus = startIndex;
                            isFocusable = true;
                        } else {
                            // do not check for single selection as all other are disabled (max item is set to one,
                            // to be refactored properly, in a way that makes sens)
                            isFocusable = !data.multipleSelect
                                    || !itemsView.initialArray[itemsView.items[moveFocus].initIndex].currentlyDisabled;
                        }
                        oldFocus = moveFocus;
                    }

                } else {
                    var moveFocus = data.focusIndex;
                }

                if (data.multipleSelect) {
                    evt.cancelDefault = this.setFocusedIndex(moveFocus);
                } else if (data.selectedIndex != null) {
                    this.setSelectedIndex(moveFocus > -1 ? itemsView.items[moveFocus].initIndex : moveFocus);
                }
                evt.cancelDefault = true;
            }
            return evt.cancelDefault;
        }
function (evtInfo) {

            var data = this._data;

            var evt = {
                name : "keyevent",
                charCode : evtInfo.charCode,
                keyCode : evtInfo.keyCode,
                focusIndex : data.focusIndex,
                cancelDefault : false
            };

            this.$raiseEvent(evt);

            if (data && !evt.cancelDefault) {

                var moveFocus, itemsView = data.itemsView;
                if (ariaDomEvent.isNavigationKey(evt.keyCode)) {
                    this._navigationEvent = true;
                    var startIndex = data.multipleSelect ? data.focusIndex : data.selectedIndex > -1 ? itemsView.getNewIndex(itemsView.items, data.selectedIndex) : data.selectedIndex, isFocusable = false, oldFocus = startIndex;
                    moveFocus = startIndex;
                    while (!isFocusable) {
                        moveFocus = this.calcMoveFocus(data.displayOptions.flowOrientation, moveFocus, data.numberOfRows, data.numberOfColumns, evt.keyCode, data.itemsView.items.length);
                        if (oldFocus == moveFocus) {
                            // Tried to move on to a disabled box that cannot be skipped because it's on the edge of
                            // the container
                            moveFocus = startIndex;
                            isFocusable = true;
                        } else {
                            // do not check for single selection as all other are disabled (max item is set to one,
                            // to be refactored properly, in a way that makes sens)
                            isFocusable = !data.multipleSelect
                                    || !itemsView.initialArray[itemsView.items[moveFocus].initIndex].currentlyDisabled;
                        }
                        oldFocus = moveFocus;
                    }

                } else {
                    var moveFocus = data.focusIndex;
                }

                if (data.multipleSelect) {
                    evt.cancelDefault = this.setFocusedIndex(moveFocus);
                } else if (data.selectedIndex != null) {
                    this.setSelectedIndex(moveFocus > -1 ? itemsView.items[moveFocus].initIndex : moveFocus);
                }
                evt.cancelDefault = true;
            }
            return evt.cancelDefault;
        }
function ( evtInfo ) { var data = this . _data ; var evt = { name : "keyevent" , charCode : evtInfo . charCode , keyCode : evtInfo . keyCode , focusIndex : data . focusIndex , cancelDefault : false } ; this . $raiseEvent ( evt ) ; if ( data && ! evt . cancelDefault ) { var moveFocus , itemsView = data . itemsView ; if ( ariaDomEvent . isNavigationKey ( evt . keyCode ) ) { this . _navigationEvent = true ; var startIndex = data . multipleSelect ? data . focusIndex : data . selectedIndex > - 1 ? itemsView . getNewIndex ( itemsView . items , data . selectedIndex ) : data . selectedIndex , isFocusable = false , oldFocus = startIndex ; moveFocus = startIndex ; while ( ! isFocusable ) { moveFocus = this . calcMoveFocus ( data . displayOptions . flowOrientation , moveFocus , data . numberOfRows , data . numberOfColumns , evt . keyCode , data . itemsView . items . length ) ; if ( oldFocus == moveFocus ) { // Tried to move on to a disabled box that cannot be skipped because it's on the edge of // the container moveFocus = startIndex ; isFocusable = true ; } else { // do not check for single selection as all other are disabled (max item is set to one, // to be refactored properly, in a way that makes sens) isFocusable = ! data . multipleSelect || ! itemsView . initialArray [ itemsView . items [ moveFocus ] . initIndex ] . currentlyDisabled ; } oldFocus = moveFocus ; } } else { var moveFocus = data . focusIndex ; } if ( data . multipleSelect ) { evt . cancelDefault = this . setFocusedIndex ( moveFocus ) ; } else if ( data . selectedIndex != null ) { this . setSelectedIndex ( moveFocus > - 1 ? itemsView . items [ moveFocus ] . initIndex : moveFocus ) ; } evt . cancelDefault = true ; } return evt . cancelDefault ; }
Notify the list controller that a key has been pressed. The controller reacts by sending a keyevent event.
Upon receiving that event, listeners can either ignore it, which leads to the default action being executed
when returning from the event, or they can override the default action by changing event properties.
@param {Object} Any object with the charCode and keyCode properties which specify which key has been pressed.
Any other property in this object is ignored.
@return {Boolean} cancel state of the event
Notify the list controller that a key has been pressed . The controller reacts by sending a keyevent event . Upon receiving that event listeners can either ignore it which leads to the default action being executed when returning from the event or they can override the default action by changing event properties .