Skip to content

Commit b8540de

Browse files
author
Benjamin Pasero
committed
properly focus dropdowns in toolbars
1 parent 569865d commit b8540de

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

src/vs/base/browser/ui/actionbar/actionbar.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,12 @@ export class BaseActionItem extends EventEmitter implements IActionItem {
137137
public focus(): void {
138138
if (this.builder) {
139139
this.builder.domFocus();
140-
this.builder.addClass('focused');
141140
}
142141
}
143142

144143
public blur(): void {
145144
if (this.builder) {
146-
this.builder.removeClass('focused');
145+
this.builder.domBlur();
147146
}
148147
}
149148

@@ -475,7 +474,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
475474
}
476475

477476
// Recompute focused item
478-
else if (event.equals(CommonKeybindings.TAB)) {
477+
else if (event.equals(CommonKeybindings.TAB) || event.equals(CommonKeybindings.SHIFT_TAB)) {
479478
this.updateFocusedItem();
480479
}
481480
});
@@ -743,6 +742,18 @@ export class SelectActionItem extends BaseActionItem {
743742
}));
744743
}
745744

745+
public focus(): void {
746+
if (this.select) {
747+
this.select.focus();
748+
}
749+
}
750+
751+
public blur(): void {
752+
if (this.select) {
753+
this.select.blur();
754+
}
755+
}
756+
746757
public render(container: HTMLElement): void {
747758
DOM.addClass(container, 'select-container');
748759
container.appendChild(this.select);

src/vs/workbench/parts/debug/browser/debugActionItems.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ export class SelectConfigActionItem extends BaseActionItem {
4949
this.setOptions().done(null, errors.onUnexpectedError);
5050
}
5151

52+
public focus(): void {
53+
if (this.select) {
54+
this.select.focus();
55+
}
56+
}
57+
58+
public blur(): void {
59+
if (this.select) {
60+
this.select.blur();
61+
}
62+
}
63+
5264
private setOptions(): Promise {
5365
let previousSelectedIndex = this.select.selectedIndex;
5466
this.select.options.length = 0;

0 commit comments

Comments
 (0)