Bug/accessibility 5 (#7008)

* fixing 6946 and 6796(second part)

* fix for https://github.com/microsoft/azuredatastudio/issues/6726

* comments cleanup

* taking PR comments

* adding strong border for HC focus

* convert to string template
This commit is contained in:
Udeesha Gautam
2019-09-09 15:37:12 -07:00
committed by GitHub
parent 66cdbbb335
commit 5ae8017233
6 changed files with 53 additions and 17 deletions

View File

@@ -99,11 +99,11 @@ export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Pl
if (!this._options.title) {
if (selectedRows.length && selectedRows.length === this._grid.getDataLength()) {
this._grid.updateColumnHeader(this._options.columnId!,
strings.format(checkboxTemplate, 'checked', this._options.title),
strings.format(checkboxTemplate, 'checked', this.getAriaLabel(true)),
this._options.toolTip);
} else {
this._grid.updateColumnHeader(this._options.columnId!,
strings.format(checkboxTemplate, '',this._options.title),
strings.format(checkboxTemplate, '', this.getAriaLabel(false)),
this._options.toolTip);
}
}
@@ -210,12 +210,12 @@ export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Pl
const rows = range(this._grid.getDataLength());
this._grid.setSelectedRows(rows);
this._grid.updateColumnHeader(this._options.columnId!,
strings.format(checkboxTemplate, 'checked', this._options.title),
strings.format(checkboxTemplate, 'checked', this.getAriaLabel(true)),
this._options.toolTip);
} else {
this._grid.setSelectedRows([]);
this._grid.updateColumnHeader(this._options.columnId!,
strings.format(checkboxTemplate, '', this._options.title), this._options.toolTip);
strings.format(checkboxTemplate, '', this.getAriaLabel(false)), this._options.toolTip);
e.stopPropagation();
e.stopImmediatePropagation();
}
@@ -243,16 +243,16 @@ export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Pl
}
return this._selectedRowsLookup[row]
? strings.format(checkboxTemplate, 'checked', this._options.title)
: strings.format(checkboxTemplate, '', this._options.title);
? strings.format(checkboxTemplate, 'checked', this.getAriaLabel(true))
: strings.format(checkboxTemplate, '', this.getAriaLabel(false));
}
checkboxTemplateCustom(row: number): string {
// use state after toggles
if (this._useState) {
return this._selectedCheckBoxLookup[row]
? strings.format(checkboxTemplate, 'checked', this._options.title)
: strings.format(checkboxTemplate, '', this._options.title);
? strings.format(checkboxTemplate, 'checked', this.getAriaLabel(true))
: strings.format(checkboxTemplate, '', this.getAriaLabel(false));
}
// use data for first time rendering
@@ -260,15 +260,20 @@ export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Pl
let rowVal = (this._grid) ? this._grid.getDataItem(row) : null;
if (rowVal && this._options.title && rowVal[this._options.title] === true) {
this._selectedCheckBoxLookup[row] = true;
return strings.format(checkboxTemplate, 'checked', this._options.title);
return strings.format(checkboxTemplate, 'checked', this.getAriaLabel(true));
}
else {
delete this._selectedCheckBoxLookup[row];
return strings.format(checkboxTemplate, '', this._options.title);
return strings.format(checkboxTemplate, '', this.getAriaLabel(false));
}
}
private isCustomActionRequested(): boolean {
return (this._options.actionOnCheck === ActionOnCheck.customAction);
}
private getAriaLabel(checked: boolean): string {
return checked ? `"${this._options.title} ${nls.localize("tableCheckboxCell.Checked", "checkbox checked")}"` :
`"${this._options.title} ${nls.localize("tableCheckboxCell.unChecked", "checkbox unchecked")}"`;
}
}