Skip to content

Commit ed119b9

Browse files
committed
Ensure widget is hidden prior to action runs (#249129)
1 parent 45cb933 commit ed119b9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/vs/platform/actionWidget/browser/actionWidgetDropdown.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class ActionWidgetDropdown extends BaseDropdown {
4848
}
4949

5050
override show(): void {
51-
const actionBarActions = this._options.actionBarActions ?? this._options.actionBarActionProvider?.getActions() ?? [];
51+
let actionBarActions = this._options.actionBarActions ?? this._options.actionBarActionProvider?.getActions() ?? [];
5252
const actions = this._options.actions ?? this._options.actionProvider?.getActions() ?? [];
5353
const actionWidgetItems: IActionListItem<IActionWidgetDropdownAction>[] = [];
5454

@@ -105,10 +105,11 @@ export class ActionWidgetDropdown extends BaseDropdown {
105105

106106
const previouslyFocusedElement = getActiveElement();
107107

108+
108109
const actionWidgetDelegate: IActionListDelegate<IActionWidgetDropdownAction> = {
109110
onSelect: (action, preview) => {
110-
action.run();
111111
this.actionWidgetService.hide();
112+
action.run();
112113
},
113114
onHide: () => {
114115
if (isHTMLElement(previouslyFocusedElement)) {
@@ -117,6 +118,14 @@ export class ActionWidgetDropdown extends BaseDropdown {
117118
}
118119
};
119120

121+
actionBarActions = actionBarActions.map(action => ({
122+
...action,
123+
run: async (...args: any[]) => {
124+
this.actionWidgetService.hide();
125+
return action.run(...args);
126+
}
127+
}));
128+
120129
this.actionWidgetService.show<IActionWidgetDropdownAction>(
121130
this._options.label ?? '',
122131
false,

0 commit comments

Comments
 (0)