in fuse-ui-fabric/tree/treeView.tsx [307:359]
private async handleKeyCommands(e: React.KeyboardEvent<HTMLElement>) {
const code = e.keyCode;
let isHandled = true;
let nextNode: ITreeNodeView = null;
if (!this.selected || this.selected.editing) {
return;
}
switch (code) {
case KeyCodes.up:
nextNode = this.findPrev(this.selected);
if (nextNode) {
this.selectNode(nextNode);
}
break;
case KeyCodes.down:
nextNode = this.findNext(this.selected);
if (nextNode) {
this.selectNode(nextNode);
}
break;
case KeyCodes.del:
await this.confirmThenDelete();
break;
case 113: //F2
this.selected.edit();
break;
case KeyCodes.right:
if (this.selected != null && this.selected.node.type === 'container') {
// expand container if not already expanded.
if (!this.selected.expanded) {
this.selected.expand();
}
}
break;
case KeyCodes.left:
this.handleCollapse();
break;
case 121: //F10
if (e.shiftKey) {
this.setState({ contextVisible: true, contextTarget: null });
}
break;
default:
isHandled = false;
}
if (isHandled) {
e.preventDefault();
e.stopPropagation();
}
}