From 24c1747dc985969456c370c01a5e6b3dcc70782b Mon Sep 17 00:00:00 2001 From: ViktorSlavov Date: Tue, 12 Feb 2019 14:25:49 +0200 Subject: [PATCH 1/2] fix(docs): add aria label to checkboxes in selection example, #15021 --- .../table-selection/table-selection-example.html | 6 ++++-- .../table-selection/table-selection-example.ts | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/material-examples/table-selection/table-selection-example.html b/src/material-examples/table-selection/table-selection-example.html index a22d56266de6..bd46d4bc5b34 100644 --- a/src/material-examples/table-selection/table-selection-example.html +++ b/src/material-examples/table-selection/table-selection-example.html @@ -5,13 +5,15 @@ + [indeterminate]="selection.hasValue() && !isAllSelected()" + [aria-label]='checkboxLabel()'> + [checked]="selection.isSelected(row)" + [aria-label]="checkboxLabel(row)"> diff --git a/src/material-examples/table-selection/table-selection-example.ts b/src/material-examples/table-selection/table-selection-example.ts index 153367376587..2b760109fa28 100644 --- a/src/material-examples/table-selection/table-selection-example.ts +++ b/src/material-examples/table-selection/table-selection-example.ts @@ -48,4 +48,12 @@ export class TableSelectionExample { this.selection.clear() : this.dataSource.data.forEach(row => this.selection.select(row)); } + + /** The label for the checkbox on the passed row */ + checkboxLabel(row?: PeriodicElement): string { + if (!row) { + return `${this.isAllSelected() ? 'select' : 'deselect'} all`; + } + return `${this.selection.isSelected(row) ? 'deselect' : 'select'} row ${row.position + 1}`; + } } From 91b2efb86eb3d10df00cf9b77c91dc78a89f5974 Mon Sep 17 00:00:00 2001 From: ViktorSlavov Date: Thu, 14 Feb 2019 10:02:55 +0200 Subject: [PATCH 2/2] chore(docs): update table-selection-example html template to use consistent double-quotes --- .../table-selection/table-selection-example.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/material-examples/table-selection/table-selection-example.html b/src/material-examples/table-selection/table-selection-example.html index bd46d4bc5b34..9bf76f15a326 100644 --- a/src/material-examples/table-selection/table-selection-example.html +++ b/src/material-examples/table-selection/table-selection-example.html @@ -6,7 +6,7 @@ + [aria-label]="checkboxLabel()">