Skip to content

Commit

Permalink
Merge pull request #197965 from r3m0t/selfish-crawdad
Browse files Browse the repository at this point in the history
[Acc] Keyboard accessible tooltips- Fixes #132344
  • Loading branch information
meganrogge authored Nov 27, 2023
2 parents c6eb717 + 53246b5 commit a55ca03
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
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 @@ -223,7 +223,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 @@ -237,9 +237,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 @@ -407,10 +406,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 @@ -135,7 +135,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

0 comments on commit a55ca03

Please sign in to comment.