提交 5280ee30 编写于 作者: I isidor

debug viewlet fix focus switching

fixes #22812
上级 d57cb0f0
......@@ -25,7 +25,7 @@ export interface IActionItem extends IEventEmitter {
setActionContext(context: any): void;
render(element: HTMLElement): void;
isEnabled(): boolean;
focus(): void;
focus(fromRight?: boolean): void;
blur(): void;
dispose(): void;
}
......@@ -617,10 +617,10 @@ export class ActionBar extends EventEmitter implements IActionRunner {
this.focusedItem = undefined;
}
this.updateFocus();
this.updateFocus(true);
}
private updateFocus(): void {
private updateFocus(fromRight?: boolean): void {
if (typeof this.focusedItem === 'undefined') {
this.domNode.focus();
return;
......@@ -633,7 +633,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
if (i === this.focusedItem) {
if (types.isFunction(actionItem.focus)) {
actionItem.focus();
actionItem.focus(fromRight);
}
} else {
if (types.isFunction(actionItem.blur)) {
......
......@@ -87,14 +87,27 @@ export class StartDebugActionItem extends EventEmitter implements IActionItem {
dom.removeClass(this.start, 'active');
}));
this.toDispose.push(dom.addDisposableListener(this.start, dom.EventType.KEY_UP, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
this.toDispose.push(dom.addDisposableListener(this.start, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter)) {
this.actionRunner.run(this.action, this.context).done(null, errors.onUnexpectedError);
}
if (event.equals(KeyCode.RightArrow)) {
this.selectBox.focus();
event.stopPropagation();
}
}));
const selectBoxContainer = $('.configuration');
this.selectBox.render(dom.append(container, selectBoxContainer));
this.toDispose.push(dom.addDisposableListener(selectBoxContainer, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.LeftArrow)) {
this.start.focus();
event.stopPropagation();
}
}));
this.selectBox.render(dom.append(container, $('.configuration')));
this.updateOptions();
}
......@@ -106,9 +119,13 @@ export class StartDebugActionItem extends EventEmitter implements IActionItem {
return true;
}
public focus(): void {
public focus(fromRight?: boolean): void {
if (fromRight) {
this.selectBox.focus();
} else {
this.start.focus();
}
}
public blur(): void {
this.container.blur();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册