Skip to content

Commit

Permalink
Only use placeholder as aria-label if we have an input box
Browse files Browse the repository at this point in the history
Fixes #179373
  • Loading branch information
TylerLeonhardt committed Apr 6, 2023
1 parent eafe8f0 commit 4fdba59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/vs/platform/quickinput/browser/quickAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ export class QuickAccessController extends Disposable implements IQuickAccessCon
}
picker.contextKey = descriptor?.contextKey;
picker.filterValue = (value: string) => value.substring(descriptor ? descriptor.prefix.length : 0);
if (descriptor?.placeholder) {
picker.ariaLabel = descriptor?.placeholder;
}

// Pick mode: setup a promise that can be resolved
// with the selected items and prevent execution
Expand Down
7 changes: 4 additions & 3 deletions src/vs/platform/quickinput/browser/quickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Disposable, DisposableStore, dispose } from 'vs/base/common/lifecycle';
import { isIOS } from 'vs/base/common/platform';
import Severity from 'vs/base/common/severity';
import { ThemeIcon } from 'vs/base/common/themables';
import { isString, withNullAsUndefined } from 'vs/base/common/types';
import { isString, withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import 'vs/css!./media/quickInput';
import { localize } from 'vs/nls';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
Expand Down Expand Up @@ -1029,15 +1029,16 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
}

let ariaLabel = this.ariaLabel;
if (!ariaLabel) {
// Only set aria label to the input box placeholder if we actually have an input box.
if (!ariaLabel && visibilities.inputBox) {
ariaLabel = this.placeholder || QuickPick.DEFAULT_ARIA_LABEL;
// If we have a title, include it in the aria label.
if (this.title) {
ariaLabel += ` - ${this.title}`;
}
}
if (this.ui.list.ariaLabel !== ariaLabel) {
this.ui.list.ariaLabel = ariaLabel;
this.ui.list.ariaLabel = withUndefinedAsNull(ariaLabel);
}
this.ui.list.matchOnDescription = this.matchOnDescription;
this.ui.list.matchOnDetail = this.matchOnDetail;
Expand Down

0 comments on commit 4fdba59

Please sign in to comment.