Skip to content

Commit 72d94de

Browse files
author
Benjamin Pasero
authored
1 parent 57e6b62 commit 72d94de

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/vs/base/parts/quickinput/browser/quickInput.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
386386
private _matchOnLabel = true;
387387
private _sortByLabel = true;
388388
private _autoFocusOnList = true;
389-
private _itemActivation = ItemActivation.FIRST;
389+
private _itemActivation = this.ui.isScreenReaderOptimized() ? ItemActivation.NONE /* https://github.com/microsoft/vscode/issues/57501 */ : ItemActivation.FIRST;
390390
private _activeItems: T[] = [];
391391
private activeItemsUpdated = false;
392392
private activeItemsToConfirm: T[] | null = [];
@@ -637,7 +637,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
637637

638638
private trySelectFirst() {
639639
if (this.autoFocusOnList) {
640-
if (!this.ui.isScreenReaderOptimized() && !this.canSelectMany) {
640+
if (!this.canSelectMany) {
641641
this.ui.list.focus(QuickInputListFocus.First);
642642
}
643643
}
@@ -867,6 +867,9 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
867867
this.ui.visibleCount.setCount(this.ui.list.getVisibleCount());
868868
this.ui.count.setCount(this.ui.list.getCheckedCount());
869869
switch (this._itemActivation) {
870+
case ItemActivation.NONE:
871+
this._itemActivation = ItemActivation.FIRST; // only valid once, then unset
872+
break;
870873
case ItemActivation.SECOND:
871874
this.ui.list.focus(QuickInputListFocus.Second);
872875
this._itemActivation = ItemActivation.FIRST; // only valid once, then unset

src/vs/base/parts/quickinput/common/quickInput.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ export interface IQuickPickAcceptEvent {
183183
}
184184

185185
export enum ItemActivation {
186-
FIRST = 1,
186+
NONE,
187+
FIRST,
187188
SECOND,
188189
LAST
189190
}

src/vs/platform/quickinput/browser/quickAccess.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ export class QuickAccessController extends Disposable implements IQuickAccessCon
9090
picker.placeholder = descriptor?.placeholder;
9191
picker.quickNavigate = options?.quickNavigateConfiguration;
9292
picker.hideInput = !!picker.quickNavigate && !visibleQuickAccess; // only hide input if there was no picker opened already
93-
picker.itemActivation = options?.itemActivation || (options?.quickNavigateConfiguration ? ItemActivation.SECOND : ItemActivation.FIRST);
93+
if (typeof options?.itemActivation === 'number' || options?.quickNavigateConfiguration) {
94+
picker.itemActivation = options?.itemActivation ?? ItemActivation.SECOND /* quick nav is always second */;
95+
}
9496
picker.contextKey = descriptor?.contextKey;
9597
picker.filterValue = (value: string) => value.substring(descriptor ? descriptor.prefix.length : 0);
9698
if (descriptor?.placeholder) {

0 commit comments

Comments
 (0)