Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T1187314 - DataGrid displays an incorrect row count in "aria-label" if there is no data after filtering #25556

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion js/__internal/grids/grid_core/views/m_grid_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ const resizingControllerMembers = {
},

_setAriaLabel() {
const totalItemsCount = Math.max(0, this._dataController.totalItemsCount());
this.component.setAria('label', messageLocalization.format(
this._getWidgetAriaLabel(),
// @ts-expect-error
this._dataController.totalItemsCount(),
totalItemsCount,
this.component.columnCount(),
), this.component.$element().children(`.${GRIDBASE_CONTAINER_CLASS}`));
},
Expand Down
4 changes: 4 additions & 0 deletions testing/testcafe/model/dataGrid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export default class DataGrid extends Widget {
return Widget.addClassPrefix(this.getName(), className);
}

getContainer(): Selector {
return this.element.find(`.${CLASS.dataGrid}`);
}

getHeaders(): Headers {
return new Headers(this.element.find(`.${this.addWidgetPrefix(CLASS.headers)}`), this.getName());
}
Expand Down
23 changes: 23 additions & 0 deletions testing/testcafe/tests/dataGrid/accessibility/bugs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import createWidget from '../../../helpers/createWidget';
import url from '../../../helpers/getPageUrl';
import DataGrid from '../../../model/dataGrid';

fixture`Accessibility bugs`
.page(url(__dirname, '../../container.html'));

test('T1187314 - DataGrid displays an incorrect row count in "aria-label" if there is no data after filtering', async (t) => {
const dataGrid = new DataGrid('#container');

await t
.expect(dataGrid.getContainer().getAttribute('aria-label'))
.eql('Data grid with 0 rows and 2 columns');
}).before(async () => createWidget('dxDataGrid', {
keyExpr: 'id',
dataSource: [{
id: 0,
data: 'A',
}],
filterRow: { visible: true },
filterValue: ['id', '=', '1'],
scrolling: { mode: 'infinite' },
}));