vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
473 stars 83 forks source link

Removing the row details renderer keeps row details and a11y-specific attributes in DOM #2080

Open vursen opened 3 years ago

vursen commented 3 years ago

Currently, if the user removes the row details renderer, the grid doesn't remove row details and corresponding a11y-specific attributes from DOM.

The row details can eventually be removed from DOM by a non-related _updateRow call. However, there is no guarantee that it happens.

Correct behavior

Removing the row details renderer should cause:

Tests

To assert removing a11y attributes from DOM, add the following tests to accessibility.test.js#L241:

it('should remove aria-expanded when removing the row details renderer', () => {
  grid.rowDetailsRenderer = undefined;

  expect(uniqueAttrValues(grid.$.items.querySelectorAll('td'), 'aria-expanded')).to.eql([null]);
});

it('should remove aria-controls when removing the row details renderer', () => {
  grid.rowDetailsRenderer = undefined;

  expect(uniqueAttrValues(grid.$.items.querySelectorAll('td'), 'aria-controls')).to.eql([null]);
});

To assert removing row details from DOM, add the following tests to renderers.test.js#L146:

it('should remove row details when removing the renderer', () => {
  grid.rowDetailsRenderer = undefined;

  expect(getBodyCellContent(grid, 0, 1)).to.be.undefined;
  expect(getBodyCellContent(grid, 1, 1)).to.be.undefined;
});
yuriy-fix commented 3 years ago

Row cells with details opened shouldn't have aria-expanded.