提交 6c058db1 编写于 作者: B Benjamin Pasero

bug fix and add some more aria labels

上级 0053dfc7
......@@ -42,16 +42,14 @@ export class Checkbox extends Widget {
this.domNode.setAttribute('aria-label', this._opts.title);
this.onclick(this.domNode, (ev) => {
this._checked = !this._checked;
this.domNode.className = this._className();
this.checked = !this._checked;
this._opts.onChange();
ev.preventDefault();
});
this.onkeydown(this.domNode, (keyboardEvent) => {
if (keyboardEvent.keyCode === KeyCode.Space || keyboardEvent.keyCode === KeyCode.Enter) {
this._checked = !this._checked;
this.domNode.className = this._className();
this.checked = !this._checked;
this._opts.onChange();
keyboardEvent.preventDefault();
return;
......
......@@ -54,7 +54,8 @@ export class BreakpointWidget extends ZoneWidget {
const inputBoxContainer = dom.append(container, $('.inputBoxContainer'));
this.inputBox = new InputBox(inputBoxContainer, this.contextViewService, {
placeholder: nls.localize('breakpointWidgetPlaceholder', "Breakpoint on line {0} will only stop if this condition is true. 'Enter' to accept, 'esc' to cancel.", this.lineNumber)
placeholder: nls.localize('breakpointWidgetPlaceholder', "Breakpoint on line {0} will only stop if this condition is true. 'Enter' to accept, 'esc' to cancel.", this.lineNumber),
ariaLabel: nls.localize('breakpointWidgetAriaLabel', "Type the breakpoint condition for line {0}. The program will only stop here if this condition is true. Press Enter to accept or Escape to cancel.")
});
this.toDispose.push(this.inputBox);
......
......@@ -73,14 +73,15 @@ export function renderVariable(tree: tree.ITree, variable: model.Variable, data:
}
}
function renderRenameBox(debugService: debug.IDebugService, contextViewService: IContextViewService, tree: tree.ITree, element: any, container: HTMLElement, placeholder: string): void {
function renderRenameBox(debugService: debug.IDebugService, contextViewService: IContextViewService, tree: tree.ITree, element: any, container: HTMLElement, placeholder: string, ariaLabel: string): void {
let inputBoxContainer = dom.append(container, $('.inputBoxContainer'));
let inputBox = new inputbox.InputBox(inputBoxContainer, contextViewService, {
validationOptions: {
validation: null,
showMessage: false
},
placeholder: placeholder
placeholder: placeholder,
ariaLabel: ariaLabel
});
inputBox.value = element.name ? element.name : '';
......@@ -577,7 +578,7 @@ export class WatchExpressionsRenderer implements tree.IRenderer {
private renderWatchExpression(tree: tree.ITree, watchExpression: debug.IExpression, data: IWatchExpressionTemplateData): void {
let selectedExpression = this.debugService.getViewModel().getSelectedExpression();
if ((selectedExpression instanceof model.Expression && selectedExpression.getId() === watchExpression.getId()) || (watchExpression instanceof model.Expression && !watchExpression.name)) {
renderRenameBox(this.debugService, this.contextViewService, tree, watchExpression, data.expression, nls.localize('watchExpressionPlaceholder', "Expression to watch"));
renderRenameBox(this.debugService, this.contextViewService, tree, watchExpression, data.expression, nls.localize('watchExpressionPlaceholder', "Expression to watch"), nls.localize('watchExpressionInputAriaLabel', "Type watch expression"));
}
data.actionBar.context = watchExpression;
......@@ -828,7 +829,7 @@ export class BreakpointsRenderer implements tree.IRenderer {
private renderFunctionBreakpoint(tree: tree.ITree, functionBreakpoint: debug.IFunctionBreakpoint, data: IFunctionBreakpointTemplateData): void {
if (!functionBreakpoint.name) {
renderRenameBox(this.debugService, this.contextViewService, tree, functionBreakpoint, data.breakpoint, nls.localize('functionBreakpointPlaceholder', "Function to break on"));
renderRenameBox(this.debugService, this.contextViewService, tree, functionBreakpoint, data.breakpoint, nls.localize('functionBreakpointPlaceholder', "Function to break on"), nls.localize('functionBreakPointInputAriaLabel', "Type function breakpoint"));
} else {
this.debugService.getModel().areBreakpointsActivated() ? tree.removeTraits('disabled', [functionBreakpoint]) : tree.addTraits('disabled', [functionBreakpoint]);
data.name.textContent = functionBreakpoint.name;
......
......@@ -285,12 +285,12 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
}
// Input field (when creating a new file or folder or renaming)
let inputBox = new InputBox(item.getHTMLElement(), this.contextViewService, {
validationOptions: {
validation: editableData.validator,
showMessage: true
}
},
ariaLabel: nls.localize('fileInputAriaLabel', "Type file name. Press Enter to confirm or Escape to cancel.")
});
let value = stat.name || '';
......
......@@ -37,7 +37,8 @@ export class CreateBranchActionItem extends ActionBar.BaseActionItem {
validationOptions: {
showMessage: false,
validation: v => this.validate(v)
}
},
ariaLabel: nls.localize('newBranchAriaLabel', "Type branch name")
});
$(this.inputBox.inputElement).on('keyup', (e: KeyboardEvent) => this.onKeyUp(e));
......
......@@ -135,6 +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),
flexibleHeight: true
});
......
......@@ -307,7 +307,6 @@ export class RefreshAction extends Action {
}
}
export class SelectOrRemoveAction extends Action {
private selectMode: boolean;
......@@ -431,7 +430,7 @@ interface IOptions {
placeholder?: string;
width?: number;
validation?: IInputValidator;
label?: string;
ariaLabel?: string;
}
class PatternInput {
......@@ -442,7 +441,7 @@ class PatternInput {
private onOptionChange: (event: Event) => void;
private width: number;
private placeholder: string;
private label: string;
private ariaLabel: string;
private listenersToRemove: any[];
private pattern: Checkbox;
......@@ -455,7 +454,7 @@ class PatternInput {
this.onOptionChange = null;
this.width = options.width || 100;
this.placeholder = options.placeholder || '';
this.label = options.label || nls.localize('defaultLabel', "input");
this.ariaLabel = options.ariaLabel || nls.localize('defaultLabel', "input");
this.listenersToRemove = [];
this.pattern = null;
......@@ -563,7 +562,7 @@ class PatternInput {
this.inputBox = new InputBox(this.domNode, this.contextViewProvider, {
placeholder: this.placeholder || '',
ariaLabel: this.label || '',
ariaLabel: this.ariaLabel || '',
validationOptions: {
validation: null,
showMessage: true
......@@ -802,7 +801,7 @@ export class SearchViewlet extends Viewlet {
builder.element('h4', { text: title });
this.inputPatternIncludes = new PatternInput(builder.getContainer(), this.contextViewService, {
label: nls.localize('label.includes', 'Includes')
ariaLabel: nls.localize('label.includes', 'Search Include Patterns')
});
this.inputPatternIncludes.setIsGlobPattern(includesUsePattern);
......@@ -832,7 +831,7 @@ export class SearchViewlet extends Viewlet {
builder.element('h4', { text: title });
this.inputPatternExclusions = new PatternInput(builder.getContainer(), this.contextViewService, {
label: nls.localize('label.excludes', 'Excludes')
ariaLabel: nls.localize('label.excludes', 'Search Exclude Patterns')
});
this.inputPatternExclusions.setIsGlobPattern(exclusionsUsePattern);
......@@ -861,7 +860,8 @@ export class SearchViewlet extends Viewlet {
builder.element('h4', { text: title });
this.inputPatternGlobalExclusions = new InputBox(builder.getContainer(), this.contextViewService, {
actions: [this.instantiationService.createInstance(ConfigureGlobalExclusionsAction)]
actions: [this.instantiationService.createInstance(ConfigureGlobalExclusionsAction)],
ariaLabel: nls.localize('label.global.excludes', 'Configured Search Exclude Patterns')
});
this.inputPatternGlobalExclusions.inputElement.readOnly = true;
$(this.inputPatternGlobalExclusions.inputElement).attr('aria-readonly', 'true');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册