Skip to content

Commit ec43422

Browse files
authored
feat: add row focus mode to convey treegrid structure (#2434)
1 parent 3b56605 commit ec43422

16 files changed

+929
-341
lines changed

packages/vaadin-grid/src/vaadin-grid-a11y-mixin.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ export const A11yMixin = (superClass) =>
7474
Array.from(row.children).forEach((cell) => cell.setAttribute('aria-selected', Boolean(selected)));
7575
}
7676

77+
/**
78+
* @param {!HTMLElement} row
79+
* @protected
80+
*/
81+
_a11yUpdateRowExpanded(row) {
82+
if (this.__isRowExpandable(row)) {
83+
row.setAttribute('aria-expanded', 'false');
84+
} else if (this.__isRowCollapsible(row)) {
85+
row.setAttribute('aria-expanded', 'true');
86+
} else {
87+
row.removeAttribute('aria-expanded');
88+
}
89+
}
90+
7791
/**
7892
* @param {!HTMLElement} row
7993
* @param {number} level

packages/vaadin-grid/src/vaadin-grid-active-item-mixin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const ActiveItemMixin = (superClass) =>
2929

3030
this.$.scroller.addEventListener('click', this._onClick.bind(this));
3131
this.addEventListener('cell-activate', this._activateItem.bind(this));
32+
this.addEventListener('row-activate', this._activateItem.bind(this));
3233
}
3334

3435
/** @private */

0 commit comments

Comments
 (0)