Skip to content

Commit 5cefa67

Browse files
authored
Merge pull request #187 from zvonimirfras/master
Fix table accessibility issues
2 parents 6e31536 + 0241ae5 commit 5cefa67

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/table/table.component.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ import { getScrollbarWidth } from "../common/utils";
206206
<svg
207207
class="bx--table-sort-v2__icon"
208208
width="10" height="5" viewBox="0 0 10 5"
209-
aria-label="Sort rows by this header in descending order"
210-
alt="Sort rows by this header in descending order">
211-
<title>Sort rows by this header in descending order</title>
209+
[attr.aria-label]="(column.sorted && column.ascending ? sortDescendingLabel : sortAscendingLabel)"
210+
[attr.alt]="(column.sorted && column.ascending ? sortDescendingLabel : sortAscendingLabel)">
211+
<title>{{(column.sorted && column.ascending ? sortDescendingLabel : sortAscendingLabel)}}</title>
212212
<path d="M0 0l5 4.998L10 0z" fill-rule="evenodd" />
213213
</svg>
214214
</button>
@@ -304,6 +304,7 @@ import { getScrollbarWidth } from "../common/utils";
304304
<button
305305
*ngIf="model.isRowExpandable(i)"
306306
(click)="model.expandRow(i, !model.rowsExpanded[i])"
307+
[attr.aria-label]="expandButtonAriaLabel"
307308
class="bx--table-expand-v2__button">
308309
<svg class="bx--table-expand-v2__svg" width="7" height="12" viewBox="0 0 7 12">
309310
<path fill-rule="nonzero" d="M5.569 5.994L0 .726.687 0l6.336 5.994-6.335 6.002L0 11.27z" />
@@ -453,6 +454,10 @@ export class Table {
453454
*/
454455
@Input() columnsDraggable = false;
455456

457+
@Input() expandButtonAriaLabel = "Expand row";
458+
@Input() sortDescendingLabel = "Sort rows by this header in descending order";
459+
@Input() sortAscendingLabel = "Sort rows by this header in ascending order";
460+
456461
/**
457462
* Controls if all checkboxes are viewed as selected.
458463
*

0 commit comments

Comments
 (0)