Skip to content

Commit 4a031fe

Browse files
authored
fix: do not set aria-expanded on grid cells (#3441)
1 parent 2a13305 commit 4a031fe

5 files changed

Lines changed: 0 additions & 47 deletions

File tree

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,6 @@ export const A11yMixin = (superClass) =>
9797
row.setAttribute('aria-level', level + 1);
9898
}
9999

100-
/**
101-
* @param {!HTMLElement} row
102-
* @param {boolean} detailsOpened
103-
* @protected
104-
*/
105-
_a11yUpdateRowDetailsOpened(row, detailsOpened) {
106-
const detailsCell = row.querySelector('[part~=details-cell]');
107-
108-
Array.from(row.children).forEach((cell) => {
109-
if (detailsCell) {
110-
cell.setAttribute('aria-expanded', detailsOpened);
111-
} else {
112-
cell.removeAttribute('aria-expanded');
113-
}
114-
});
115-
}
116-
117100
/**
118101
* @param {!HTMLElement} row
119102
* @param {!HTMLElement} detailsCell

‎packages/grid/src/vaadin-grid-row-details-mixin.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const RowDetailsMixin = (superClass) =>
8484
if (!row.querySelector('[part~=details-cell]')) {
8585
this._updateRow(row, this._columnTree[this._columnTree.length - 1]);
8686
const isDetailsOpened = this._isDetailsOpened(row._item);
87-
this._a11yUpdateRowDetailsOpened(row, isDetailsOpened);
8887
this._toggleDetailsCell(row, isDetailsOpened);
8988
}
9089
});

‎packages/grid/src/vaadin-grid.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,6 @@ class Grid extends ElementMixin(
910910

911911
this._a11yUpdateRowLevel(row, model.level);
912912
this._a11yUpdateRowSelected(row, model.selected);
913-
this._a11yUpdateRowDetailsOpened(row, model.detailsOpened);
914913

915914
row.toggleAttribute('expanded', model.expanded);
916915
row.toggleAttribute('selected', model.selected);

‎packages/grid/test/accessibility.test.js‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ describe('accessibility', () => {
173173
});
174174

175175
describe('row details not in use', () => {
176-
it('should not have aria-expanded on body cells', () => {
177-
expect(uniqueAttrValues(grid.$.items.querySelectorAll('td'), 'aria-expanded')).to.eql([null]);
178-
});
179-
180176
it('should not have aria-controls on body cells', () => {
181177
expect(uniqueAttrValues(grid.$.items.querySelectorAll('td'), 'aria-controls')).to.eql([null]);
182178
});
@@ -259,10 +255,6 @@ describe('accessibility', () => {
259255
});
260256

261257
describe('row details in use', () => {
262-
it('should have aria-expanded false on body cells', () => {
263-
expect(uniqueAttrValues(grid.$.items.querySelectorAll('td'), 'aria-expanded')).to.eql(['false']);
264-
});
265-
266258
it('should have aria-controls referencing detail cell id on body cells', () => {
267259
Array.from(grid.$.items.children).forEach((row) => {
268260
const detailsCell = row.querySelector('td[part~="details-cell"]');
@@ -274,23 +266,6 @@ describe('accessibility', () => {
274266
]);
275267
});
276268
});
277-
278-
it('should set aria-expanded true on cells after row details opened', () => {
279-
grid.openItemDetails(grid.items[0]);
280-
281-
expect(uniqueAttrValues(grid.$.items.children[0].children, 'aria-expanded')).to.eql(['true']);
282-
283-
expect(uniqueAttrValues(grid.$.items.children[1].children, 'aria-expanded')).to.eql(['false']);
284-
});
285-
286-
it('should set aria-expanded false on cells after row details closed', () => {
287-
grid.openItemDetails(grid.items[0]);
288-
grid.closeItemDetails(grid.items[0]);
289-
290-
expect(uniqueAttrValues(grid.$.items.children[0].children, 'aria-expanded')).to.eql(['false']);
291-
292-
expect(uniqueAttrValues(grid.$.items.children[1].children, 'aria-expanded')).to.eql(['false']);
293-
});
294269
});
295270
});
296271

‎packages/grid/test/row-details.test.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ describe('row details', () => {
403403
await nextFrame();
404404
const detailsCell = bodyRows[0].querySelector('[part~="details-cell"]');
405405
expect(detailsCell.hidden).to.be.true;
406-
expect(detailsCell.getAttribute('aria-expanded')).to.equal('false');
407406
});
408407

409408
it('should have the details cell initially visible', async () => {
@@ -412,7 +411,6 @@ describe('row details', () => {
412411
await nextFrame();
413412
const detailsCell = bodyRows[0].querySelector('[part~="details-cell"]');
414413
expect(detailsCell.hidden).to.be.false;
415-
expect(detailsCell.getAttribute('aria-expanded')).to.equal('true');
416414
});
417415

418416
it('should have the details cell become visible when details opened', async () => {
@@ -422,7 +420,6 @@ describe('row details', () => {
422420
await nextFrame();
423421
const detailsCell = bodyRows[0].querySelector('[part~="details-cell"]');
424422
expect(detailsCell.hidden).to.be.false;
425-
expect(detailsCell.getAttribute('aria-expanded')).to.equal('true');
426423
});
427424
});
428425
});

0 commit comments

Comments
 (0)