public onKeydown()

in desktop/src/@batch-flask/core/key-navigator/list-key-navigator.ts [160:191]


    public onKeydown(event: KeyboardEvent): void {
        const keyCode = event.keyCode;
        switch (event.code) {
            case KeyCode.ArrowDown:
                this.focusNextItem();
                break;
            case KeyCode.ArrowUp:
                this.focusPreviousItem();
                break;
            case KeyCode.ArrowRight:
                this.focusNextColumn();
                break;
            case KeyCode.ArrowLeft:
                this.focusPreviousColumn();
                break;
            default:
                // Attempt to use the `event.key` which also maps it to the user's keyboard language,
                // otherwise fall back to resolving alphanumeric characters via the keyCode.
                if (event.key && event.key.length === 1) {
                    this._letterKeyStream.next(event.key.toLocaleUpperCase());
                } else if ((keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE)) {
                    this._letterKeyStream.next(String.fromCharCode(keyCode));
                }

                // Note that we return here, in order to avoid preventing
                // the default action of non-navigational keys.
                return;
        }

        this._pressedLetters = [];
        event.preventDefault();
    }