Skip to content

Commit 60b613f

Browse files
authored
Data table delete button accessibility (#6431)
## Motivation for features / changes Not recommended to put a click event on an icon because it has accessibility problems, so this change aims to address that. ## Technical description of changes Wrap the delete icon in a <button> and have the on click component from the button and not the icon. ## Screenshots of UI changes (or N/A) N/A ## Detailed steps to verify changes work correctly (as executed by you) ## Alternate designs / implementations considered (or N/A)
1 parent 6c0f32b commit 60b613f

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

tensorboard/webapp/widgets/data_table/header_cell_component.ng.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
>
2424
<ng-content></ng-content>
2525
<div *ngIf="hparamsEnabled" class="delete-icon-container">
26-
<mat-icon
26+
<button
2727
class="delete-icon"
28-
svgIcon="close_24px"
28+
mat-icon-button
29+
i18n-aria-label="A button to delete a data table column."
30+
aria-label="Delete column"
2931
(click)="deleteButtonClicked.emit(header)"
3032
>
31-
</mat-icon>
33+
<mat-icon svgIcon="close_24px"> </mat-icon>
34+
</button>
3235
</div>
3336
<tb-data-table-header [header]="header"></tb-data-table-header>
3437
<div *ngIf="sortable" class="sorting-icon-container">

tensorboard/webapp/widgets/data_table/header_cell_component.scss

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,36 @@ $_accent: map-get(mat.get-color-config($tb-theme), accent);
4646
opacity: 1;
4747
}
4848

49-
.delete-icon-container {
50-
border-radius: 5px;
49+
.delete-icon {
50+
background-color: #fff;
51+
border: 0;
52+
border-radius: 50%;
5153
color: mat.get-color-from-palette(mat.$gray-palette, 500);
52-
height: 12px;
53-
margin-left: -12px;
54-
opacity: 0;
55-
position: absolute;
56-
width: 12px;
54+
font-size: 11px;
55+
height: 11px;
56+
margin-top: 2px;
57+
padding: 0;
58+
width: 11px;
59+
60+
.mat-icon {
61+
width: 100%;
62+
height: 100%;
63+
}
5764
}
5865

59-
.delete-icon-container:hover {
66+
.delete-icon:hover {
67+
background-color: mat.get-color-from-palette(mat.$gray-palette, 400);
6068
color: #fff;
69+
cursor: pointer;
70+
}
71+
72+
.delete-icon-container {
73+
margin-left: -12px;
74+
opacity: 0;
75+
position: absolute;
6176
}
6277

63-
.delete-icon-container:hover {
78+
.delete-icon:hover {
6479
background-color: mat.get-color-from-palette(mat.$gray-palette, 400);
6580
cursor: pointer;
6681
}

0 commit comments

Comments
 (0)