public handleKeyboardNavigation()

in desktop/src/@batch-flask/ui/activity/activity-monitor/activity-monitor-tree-view/activity-monitor-tree-view.component.ts [96:133]


    public handleKeyboardNavigation(event: KeyboardEvent) {
        event.stopImmediatePropagation();
        if (!this.isFocused) { return; }
        const curTreeRow = this.treeRows[this.focusedIndex];
        switch (event.code) {
            case "ArrowDown": // Move focus down
                this.focusedIndex++;
                this.focusedAction = null;
                event.preventDefault();
                break;
            case "ArrowUp":   // Move focus up
                this.focusedIndex--;
                this.focusedAction = null;
                event.preventDefault();
                break;
            case "ArrowRight":
                this._onRightPress(curTreeRow, event.ctrlKey);
                event.preventDefault();
                break;
            case "ArrowLeft":
                this._onLeftPress(curTreeRow, event.ctrlKey);
                event.preventDefault();
                break;
            case "Space":
            case "Enter":
                if (this.focusedAction === null) {
                    this.toggleRowExpand(curTreeRow);
                } else {
                    this._execItemAction(curTreeRow);
                }
                event.preventDefault();
                return;
            default:
                break;
        }
        this.focusedIndex = (this.focusedIndex + this.treeRows.length) % this.treeRows.length;
        this.changeDetector.markForCheck();
    }