Skip to content

Commit f43d8bc

Browse files
committed
List of recent editors + screen reader should not read input box placeholder
fixes microsoft#94587
1 parent da99f1f commit f43d8bc

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -825,12 +825,15 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
825825
if (!this.visible) {
826826
return;
827827
}
828-
let hideInput: boolean;
829-
if (this.ui.isScreenReaderOptimized()) {
830-
// Always show input if screen reader attached https://github.com/microsoft/vscode/issues/94360
831-
hideInput = false;
832-
} else {
833-
hideInput = !!this._hideInput && this._items.length > 0; // do not allow to hide input without items
828+
let hideInput = false;
829+
let inputShownJustForScreenReader = false;
830+
if (!!this._hideInput && this._items.length > 0) {
831+
if (this.ui.isScreenReaderOptimized()) {
832+
// Always show input if screen reader attached https://github.com/microsoft/vscode/issues/94360
833+
inputShownJustForScreenReader = true;
834+
} else {
835+
hideInput = true;
836+
}
834837
}
835838
dom.toggleClass(this.ui.container, 'hidden-input', hideInput);
836839
const visibilities: Visibilities = {
@@ -858,7 +861,9 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
858861
if (this.ui.inputBox.placeholder !== (this.placeholder || '')) {
859862
this.ui.inputBox.placeholder = (this.placeholder || '');
860863
}
861-
if (this.ui.inputBox.ariaLabel !== this.ariaLabel) {
864+
if (inputShownJustForScreenReader) {
865+
this.ui.inputBox.ariaLabel = '';
866+
} else if (this.ui.inputBox.ariaLabel !== this.ariaLabel) {
862867
this.ui.inputBox.ariaLabel = this.ariaLabel;
863868
}
864869
this.ui.list.matchOnDescription = this.matchOnDescription;

0 commit comments

Comments
 (0)