提交 98132ad8 编写于 作者: B Benjamin Pasero

a11y: provide more context in aria labels

上级 0a102231
......@@ -2,8 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import types = require('vs/base/common/types');
import URI from 'vs/base/common/uri';
......@@ -716,7 +718,7 @@ export class QuickOpenModel implements
}
getAriaLabel(entry: QuickOpenEntry): string {
return entry.getLabel();
return nls.localize('quickOpenAriaLabel', "{0}, quick picker", entry.getLabel());
}
isVisible<T>(entry: QuickOpenEntry): boolean {
......
......@@ -78,7 +78,7 @@ class VariablesView extends viewlet.CollapsibleViewletView {
dataSource: new viewer.VariablesDataSource(this.debugService),
renderer: this.instantiationService.createInstance(viewer.VariablesRenderer),
controller: new viewer.BaseDebugController(this.debugService, this.contextMenuService, new viewer.VariablesActionProvider(this.instantiationService))
}, debugTreeOptions(nls.localize('variablesAriaTreeLabel', "Variables")));
}, debugTreeOptions(nls.localize('variablesAriaTreeLabel', "Debug Variables")));
const viewModel = this.debugService.getViewModel();
......@@ -146,7 +146,7 @@ class WatchExpressionsView extends viewlet.CollapsibleViewletView {
dataSource: new viewer.WatchExpressionsDataSource(this.debugService),
renderer: this.instantiationService.createInstance(viewer.WatchExpressionsRenderer, actionProvider, this.actionRunner),
controller: new viewer.WatchExpressionsController(this.debugService, this.contextMenuService, actionProvider)
}, debugTreeOptions(nls.localize('watchAriaTreeLabel', "Watch Expressions")));
}, debugTreeOptions(nls.localize('watchAriaTreeLabel', "Debug Watch Expressions")));
this.tree.setInput(this.debugService.getModel());
......@@ -216,7 +216,7 @@ class CallStackView extends viewlet.CollapsibleViewletView {
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.CallStackDataSource(),
renderer: this.instantiationService.createInstance(viewer.CallStackRenderer)
}, debugTreeOptions(nls.localize('callStackAriaLabel', "Call Stack")));
}, debugTreeOptions(nls.localize('callStackAriaLabel', "Debug Call Stack")));
const debugModel = this.debugService.getModel();
......@@ -357,7 +357,7 @@ class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
return first.desiredLineNumber - second.desiredLineNumber;
}
}
}, debugTreeOptions(nls.localize('breakpointsAriaTreeLabel', "Breakpoints")));
}, debugTreeOptions(nls.localize('breakpointsAriaTreeLabel', "Debug Breakpoints")));
const debugModel = this.debugService.getModel();
......
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/repl';
import nls = require('vs/nls');
import { TPromise, Promise } from 'vs/base/common/winjs.base';
import errors = require('vs/base/common/errors');
import lifecycle = require('vs/base/common/lifecycle');
......@@ -27,10 +28,11 @@ import { CommonKeybindings } from 'vs/base/common/keyCodes';
const $ = dom.emmet;
const replTreeOptions = {
const replTreeOptions: tree.ITreeOptions = {
indentPixels: 8,
twistiePixels: 20,
paddingOnRow: false
paddingOnRow: false,
ariaLabel: nls.localize('replAriaLabel', "Read Eval Print Loop Panel")
};
const HISTORY_STORAGE_KEY = 'debug.repl.history';
......@@ -117,10 +119,9 @@ export class Repl extends Panel {
}
}
}));
this.toDispose.push(dom.addStandardDisposableListener(this.replInput, dom.EventType.FOCUS, () => dom.addClass(replInputContainer, 'synthetic-focus'))),
this.toDispose.push(dom.addStandardDisposableListener(this.replInput, dom.EventType.FOCUS, () => dom.addClass(replInputContainer, 'synthetic-focus')));
this.toDispose.push(dom.addStandardDisposableListener(this.replInput, dom.EventType.BLUR, () => dom.removeClass(replInputContainer, 'synthetic-focus')));
this.characterWidthSurveyor = dom.append(container, $('.surveyor'));
this.characterWidthSurveyor.textContent = Repl.HALF_WIDTH_TYPICAL;
for (let i = 0; i < 10; i++) {
......
......@@ -23,7 +23,7 @@ export class EmptyView extends CollapsibleView {
constructor(@IInstantiationService private instantiationService: IInstantiationService) {
super({
minimumSize: 2 * 22,
ariaHeaderLabel: nls.localize('explorerSection', "Explorer Section")
ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section")
});
}
......
......@@ -75,7 +75,7 @@ export class ExplorerView extends CollapsibleViewletView {
@IPartService private partService: IPartService,
@IConfigurationService private configurationService: IConfigurationService
) {
super(actionRunner, false, nls.localize('explorerSection', "Explorer Section"), messageService, contextMenuService);
super(actionRunner, false, nls.localize('explorerSection', "Files Explorer Section"), messageService, contextMenuService);
this.workspace = contextService.getWorkspace();
......
......@@ -342,7 +342,7 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
export class FileAccessibilityProvider implements IAccessibilityProvider {
public getAriaLabel(tree: ITree, stat: FileStat): string {
return stat.name;
return nls.localize('filesExplorerViewerAriaLabel', "{0}, Files Explorer", stat.name);
}
}
......
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import nls = require('vs/nls');
import {TPromise, Promise} from 'vs/base/common/winjs.base';
import platform = require('vs/base/common/platform');
import {$} from 'vs/base/browser/builder';
......@@ -119,7 +120,7 @@ export class WorkingFilesAccessibilityProvider implements IAccessibilityProvider
getAriaLabel(tree: ITree, element: any): string {
let entry = <WorkingFileEntry>element;
return paths.basename(entry.resource.fsPath);
return nls.localize('workingFilesViewerAriaLabel', "{0}, Working Files", paths.basename(entry.resource.fsPath));
}
}
......
......@@ -135,7 +135,7 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV
showMessage: true,
validation: (): InputBox.IMessage => null
},
ariaLabel: nls.localize('commitMessageAriaLabel', "Type commit message (press {0} to commit)", ChangesView.COMMIT_KEYBINDING),
ariaLabel: nls.localize('commitMessageAriaLabel', "Git: Type commit message and press {0} to commit", ChangesView.COMMIT_KEYBINDING),
flexibleHeight: true
});
......@@ -176,7 +176,7 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV
}, {
indentPixels: 0,
twistiePixels: 20,
ariaLabel: nls.localize('treeAriaLabel', "Changes View")
ariaLabel: nls.localize('treeAriaLabel', "Git Changes View")
});
this.tree.setInput(this.gitService.getModel().getStatus());
......
......@@ -656,14 +656,14 @@ export class AccessibilityProvider implements tree.IAccessibilityProvider {
const name = lastSlashIndex === -1 ? path : path.substr(lastSlashIndex + 1, path.length);
const folder = (lastSlashIndex === -1 ? '' : path.substr(0, lastSlashIndex));
return nls.localize('fileStatusAriaLabel', "File {0} in folder {1} has status: {2}", name, folder, Renderer.statusToTitle(status));
return nls.localize('fileStatusAriaLabel', "File {0} in folder {1} has status: {2}, Git", name, folder, Renderer.statusToTitle(status));
}
if (element instanceof gitmodel.StatusGroup) {
switch ( (<gitmodel.StatusGroup>element).getType()) {
case git.StatusType.INDEX: return nls.localize('ariaLabelStagedChanges', "Staged Changes");
case git.StatusType.WORKING_TREE: return nls.localize('ariaLabelChanges', "Changes");
case git.StatusType.MERGE: return nls.localize('ariaLabelMerge', "Merge");
case git.StatusType.INDEX: return nls.localize('ariaLabelStagedChanges', "Staged Changes, Git");
case git.StatusType.WORKING_TREE: return nls.localize('ariaLabelChanges', "Changes, Git");
case git.StatusType.MERGE: return nls.localize('ariaLabelMerge', "Merge, Git");
}
}
}
......
......@@ -143,11 +143,11 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider {
if (element instanceof FileMatch) {
const path = this.contextService.toWorkspaceRelativePath(element.resource()) || element.resource().fsPath;
return nls.localize('fileMatchAriaLabel', "{0} matches in file {1} of folder {2}", element.count(), element.name(), paths.dirname(path));
return nls.localize('fileMatchAriaLabel', "{0} matches in file {1} of folder {2}, Search result", element.count(), element.name(), paths.dirname(path));
}
if (element instanceof Match) {
return element.text();
return nls.localize('searchResultAria', "{0}, Search result", element.text());
}
}
}
......@@ -743,7 +743,7 @@ export class SearchViewlet extends Viewlet {
this.queryBox = builder.div({ 'class': 'query-box' }, (div) => {
let options = {
label: nls.localize('label.Search', 'Search Term'),
label: nls.localize('label.Search', 'Search: Type Search Term and press Enter to search or Escape to cancel'),
validation: (value: string) => {
if (value.length === 0) {
return null;
......@@ -887,8 +887,8 @@ export class SearchViewlet extends Viewlet {
controller: new SearchController(),
accessibilityProvider: this.instantiationService.createInstance(SearchAccessibilityProvider)
}, {
ariaLabel: nls.localize('treeAriaLabel', "Search Results")
});
ariaLabel: nls.localize('treeAriaLabel', "Search Results")
});
this.toUnbind.push(() => renderer.dispose());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册