mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Adding aria label to "check all" check box in declarative table. (#13216)
* added arialable for check all checkboxes and added some missing roles for the table elements * removed duplicate attribute * Moved column header aria label logic to a function. * fixed typos in declarative table * Changed the aria label text to something that is more intuiive. * fixed typo in localized string identifier
This commit is contained in:
@@ -1,22 +1,28 @@
|
|||||||
<table role=grid #container *ngIf="columns" class="declarative-table" [style.height]="getHeight()"
|
<table role="grid" #container *ngIf="columns" class="declarative-table" [style.height]="getHeight()"
|
||||||
[style.width]="getWidth()" [attr.aria-label]="ariaLabel">
|
[style.width]="getWidth()" [attr.aria-label]="ariaLabel">
|
||||||
<thead>
|
<thead role="rowgroup">
|
||||||
|
<tr role="row">
|
||||||
<ng-container *ngFor="let column of columns; let c = index;">
|
<ng-container *ngFor="let column of columns; let c = index;">
|
||||||
<th class="declarative-table-header" aria-sort="none" [style.width]="getColumnWidth(column)"
|
<th class="declarative-table-header" aria-sort="none" [style.width]="getColumnWidth(column)"
|
||||||
[attr.aria-label]="column.ariaLabel" [ngStyle]="column.headerCssStyles" role="columnheader">
|
[ngStyle]="column.headerCssStyles"
|
||||||
|
[attr.aria-label]="getHeaderAriaLabel(c)">
|
||||||
{{column.displayName}}
|
{{column.displayName}}
|
||||||
<checkbox *ngIf="isCheckBox(c)" [checked]="isHeaderChecked(c)"
|
<checkbox *ngIf="isCheckBox(c)" [checked]="isHeaderChecked(c)"
|
||||||
(onChange)="onHeaderCheckBoxChanged($event,c)" label=""></checkbox>
|
[aria-label]="getCheckAllColumnAriaLabel(c)" (onChange)="onHeaderCheckBoxChanged($event,c)"
|
||||||
|
label=""></checkbox>
|
||||||
</th>
|
</th>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
<tbody role="rowgroup">
|
||||||
<ng-container *ngIf="data.length > 0">
|
<ng-container *ngIf="data.length > 0">
|
||||||
<ng-container *ngFor="let row of data;let r = index;">
|
<ng-container *ngFor="let row of data;let r = index;">
|
||||||
<tr class="declarative-table-row" [class.selected]="isRowSelected(r)">
|
<tr class="declarative-table-row" [class.selected]="isRowSelected(r)" role="row">
|
||||||
<ng-container *ngFor="let cellData of row;let c = index;trackBy:trackByFnCols">
|
<ng-container *ngFor="let cellData of row;let c = index;trackBy:trackByFnCols">
|
||||||
<td class="declarative-table-cell" [style.width]="getColumnWidth(c)"
|
<td class="declarative-table-cell" [style.width]="getColumnWidth(c)"
|
||||||
[attr.aria-label]="getAriaLabel(r, c)"
|
[attr.aria-label]="getAriaLabel(r, c)"
|
||||||
[ngStyle]="mergeCss(columns[c].rowCssStyles, cellData.style)">
|
[ngStyle]="mergeCss(columns[c].rowCssStyles, cellData.style)"
|
||||||
|
role="gridcell">
|
||||||
<checkbox *ngIf="isCheckBox(c)" label="" (onChange)="onCheckBoxChanged($event,r,c)"
|
<checkbox *ngIf="isCheckBox(c)" label="" (onChange)="onCheckBoxChanged($event,r,c)"
|
||||||
[enabled]="isControlEnabled(c)" [checked]="isChecked(r,c)"
|
[enabled]="isControlEnabled(c)" [checked]="isChecked(r,c)"
|
||||||
[ngStyle]="mergeCss(columns[c].rowCssStyles, cellData.style)">
|
[ngStyle]="mergeCss(columns[c].rowCssStyles, cellData.style)">
|
||||||
@@ -42,4 +48,5 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -220,6 +220,15 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getCheckAllColumnAriaLabel(colIdx: number): string {
|
||||||
|
return localize('checkAllColumnLabel', "check all checkboxes in column: {0}", this.columns[colIdx].displayName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getHeaderAriaLabel(colIdx: number): string {
|
||||||
|
const column = this.columns[colIdx];
|
||||||
|
return (column.ariaLabel) ? column.ariaLabel : column.displayName;
|
||||||
|
}
|
||||||
|
|
||||||
public getItemDescriptor(componentId: string): IComponentDescriptor {
|
public getItemDescriptor(componentId: string): IComponentDescriptor {
|
||||||
return this.modelStore.getComponentDescriptor(componentId);
|
return this.modelStore.getComponentDescriptor(componentId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user