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

debug viewlet fix focus switching

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