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

[Acc] Keyboard accessible tooltips- Fixes #132344 #197965

Merged
merged 1 commit into from
Nov 27, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/vs/base/browser/ui/actionbar/actionViewItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
return;
}
const title = this.getTooltip() ?? '';
this.updateAriaLabel();
this.updateAriaLabel(title);
if (!this.options.hoverDelegate) {
this.element.title = title;
} else {
Expand All @@ -233,9 +233,8 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
}
}

protected updateAriaLabel(): void {
protected updateAriaLabel(title: string): void {
if (this.element) {
const title = this.getTooltip() ?? '';
this.element.setAttribute('aria-label', title);
}
}
Expand Down Expand Up @@ -404,10 +403,10 @@ export class ActionViewItem extends BaseActionViewItem {
}
}

protected override updateAriaLabel(): void {
protected override updateAriaLabel(title: string): void {
if (this.label) {
const title = this.getTooltip() ?? '';
this.label.setAttribute('aria-label', title);
this.label.title = title;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/windows/electron-main/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function defaultBrowserWindowOptions(accessor: ServicesAccessor, windowSt
autoplayPolicy: 'user-gesture-required',
// Enable experimental css highlight api https://chromestatus.com/feature/5436441440026624
// Refs https://github.com/microsoft/vscode/issues/140098
enableBlinkFeatures: 'HighlightAPI',
enableBlinkFeatures: 'HighlightAPI, KeyboardAccessibleTooltip',
...overrides?.webPreferences,
sandbox: true
},
Expand Down
3 changes: 3 additions & 0 deletions src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ class FileItem extends BreadcrumbsItem {
render(container: HTMLElement): void {
// file/folder
const label = this._labels.create(container);
this._disposables.add(label.onDidRender(() => {
container.title = container.children[0]?.ariaLabel ?? '';
}));
label.setFile(this.element.uri, {
hidePath: true,
hideIcon: this.element.kind === FileKind.FOLDER || !this.options.showFileIcons,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ export class DocumentSymbolRenderer implements ITreeRenderer<OutlineElement, Fuz
renderElement(node: ITreeNode<OutlineElement, FuzzyScore>, _index: number, template: DocumentSymbolTemplate): void {
const { element } = node;
const extraClasses = ['nowrap'];
const title = localize('title.template', "{0} ({1})", element.symbol.name, symbolKindNames[element.symbol.kind]);
const options: IIconLabelValueOptions = {
matches: createMatches(node.filterData),
labelEscapeNewLines: true,
extraClasses,
title: localize('title.template', "{0} ({1})", element.symbol.name, symbolKindNames[element.symbol.kind])
title
};
template.container.title = title;
if (this._configurationService.getValue(OutlineConfigKeys.icons)) {
// add styles for the icons
template.iconClass.className = '';
Expand Down
Loading