Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use placeholder as aria-label if we have an input box #179420

Merged
merged 1 commit into from Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/vs/platform/quickinput/browser/quickAccess.ts
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
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