-
Notifications
You must be signed in to change notification settings - Fork 665
ValidationSummary: add accessibility support #32234
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
base: 26_1
Are you sure you want to change the base?
ValidationSummary: add accessibility support #32234
Conversation
4c61225 to
942ae91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds accessibility support to the ValidationSummary widget by implementing a screen reader announcement container and refactoring multiple components to use a shared CSS class for screen reader-only content.
Changes:
- Adds an ARIA live region (role="alert") to ValidationSummary to announce validation errors to screen readers
- Introduces a new shared CSS class
dx-screen-reader-onlyfor consistent screen reader-only styling across components - Refactors scheduler and grid accessibility status containers to use the new shared CSS class
- Updates test descriptions to remove unnecessary apostrophes and escapes
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/js/__internal/ui/m_validation_summary.ts | Adds announce container initialization, text announcement logic, and state tracking for screen reader announcements |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/validationSummary.markup.tests.js | Updates test descriptions for consistency and adds new accessibility tests for announce container |
| packages/devextreme-scss/scss/widgets/base/_ui.scss | Adds new shared dx-screen-reader-only CSS class with standard visually-hidden pattern |
| packages/devextreme-scss/scss/widgets/base/_gridBase.scss | Removes old grid-specific screen reader CSS class in favor of shared class |
| packages/devextreme/js/__internal/scheduler/a11y_status/a11y_status_render.ts | Updates to use shared dx-screen-reader-only class |
| packages/devextreme/js/__internal/grids/new/grid_core/accessibility/status.tsx | Updates to use shared dx-screen-reader-only class |
| packages/devextreme/js/__internal/grids/grid_core/views/a11y_status_container_component.ts | Updates to use shared dx-screen-reader-only class |
| packages/devextreme/js/__internal/grids/new/card_view/snapshots/widget.test.ts.snap | Updates snapshot to reflect new class name and removes trailing whitespace |
...ges/devextreme/testing/tests/DevExpress.ui.widgets.editors/validationSummary.markup.tests.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
...ges/devextreme/testing/tests/DevExpress.ui.widgets.editors/validationSummary.markup.tests.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
packages/devextreme/js/__internal/ui/m_validation_summary.ts:208
- The new accessibility announce logic is only invoked from
_groupValidationHandler, so when items are updated via_itemValidationHandler(e.g., after the initial group validation when individual validators re‑validate on field changes), the live region text in the.dx-screen-reader-onlycontainer is not updated and_lastAnnouncedTextmay become out of sync with the visible summary items. To keep the screen-reader announcement consistent with the current validation state,_itemValidationHandlershould trigger the same announce flow (e.g., by calling_announceOnGroupValidationwhenitemsChangedis true, or otherwise updating the announce container whenever theitemsoption changes).
_itemValidationHandler({ isValid, validator, brokenRules }): void {
let { items } = this.option();
let itemsChanged = false;
let itemIndex = 0;
// @ts-expect-error ts-error
while (itemIndex < items.length) {
// @ts-expect-error ts-error
const item = items[itemIndex];
if (item.validator === validator) {
const foundRule = grep(brokenRules || [], (rule) => rule.index === item.index)[0];
if (isValid || !foundRule) {
// @ts-expect-error ts-error
items.splice(itemIndex, 1);
itemsChanged = true;
continue;
}
if (foundRule.message !== item.text) {
item.text = foundRule.message;
itemsChanged = true;
}
}
itemIndex++;
}
each(brokenRules, (_, rule) => {
const foundItem = grep(items, (item) => item.validator === validator && item.index === rule.index)[0];
if (!foundItem) {
// @ts-expect-error ts-error
items.push({
text: rule.message,
validator,
index: rule.index,
});
itemsChanged = true;
}
});
if (itemsChanged) {
items = this._getOrderedItems(this.validators, items);
this.option('items', items);
}
No description provided.