Skip to content

Commit d389f08

Browse files
Adriana IxbaDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Fix a11y 3P table navigation and keyboard navigation
- Adds table label for focus (b/392169056) - Adds aria-sort label on column headers (b/392649075) - Includes hover button on select for keyboard navigation (b/392646319) Bug:392649075,392169056,392646319 Change-Id: I5fad0ae43df87e0ea562f2fde35890d810db1872 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6209999 Commit-Queue: Paul Irish <[email protected]> Commit-Queue: Adriana Ixba <[email protected]> Reviewed-by: Paul Irish <[email protected]>
1 parent b48fdf2 commit d389f08

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

front_end/panels/timeline/TimelineUIUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ const UIStrings = {
510510
* @description Text to refer to a 3rd Party entity.
511511
*/
512512
entity: '3rd party entity',
513+
/**
514+
* @description Label for third party table.
515+
*/
516+
thirdPartyTable: '1st / 3rd party table',
513517
};
514518
const str_ = i18n.i18n.registerUIStrings('panels/timeline/TimelineUIUtils.ts', UIStrings);
515519
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -2231,6 +2235,7 @@ export class TimelineUIUtils {
22312235

22322236
const thirdPartyDiv = document.createElement('div');
22332237
thirdPartyDiv.className = 'third-party-table';
2238+
UI.ARIAUtils.setLabel(thirdPartyDiv, i18nString(UIStrings.thirdPartyTable));
22342239

22352240
treeSlot.name = 'third-party-table';
22362241
treeSlot.append(treeView);

front_end/panels/timeline/components/timelineSummary.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
font-weight: var(--ref-typeface-weight-medium);
9090
}
9191

92-
tr.revealed:hover {
92+
tr.revealed:hover,
93+
tr.selected {
9394
.button-container {
9495
align-items: center;
9596
display: block;

front_end/ui/legacy/components/data_grid/DataGrid.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,12 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
12741274
this.sortByColumnHeaderCell((cell as HTMLElement));
12751275
}
12761276

1277+
/**
1278+
* Sorts by column header cell.
1279+
* Additionally applies the aria-sort label to a column's th.
1280+
* Guidance on values of attribute taken from
1281+
* https://www.w3.org/TR/wai-aria-practices/examples/grid/dataGrids.html.
1282+
*/
12771283
private sortByColumnHeaderCell(cell: Element): void {
12781284
if (!nodeToColumnIdMap.has(cell) || !cell.classList.contains('sortable')) {
12791285
return;
@@ -1286,10 +1292,13 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
12861292

12871293
if (this.sortColumnCell) {
12881294
this.sortColumnCell.classList.remove(Order.Ascending, Order.Descending);
1295+
this.sortColumnCell.removeAttribute('aria-sort');
12891296
}
12901297
this.sortColumnCell = cell;
12911298

12921299
cell.classList.add(sortOrder);
1300+
const ariaLabel = this.isSortOrderAscending() ? 'ascending' : 'descending';
1301+
cell.setAttribute('aria-sort', ariaLabel);
12931302

12941303
this.dispatchEventToListeners(Events.SORTING_CHANGED);
12951304
}

0 commit comments

Comments
 (0)