Skip to content

AB#120092 Screen-reader fix fo data-only messages#269

Open
sushmi21 wants to merge 3 commits intomainfrom
bug/120092-screen-reader-fix
Open

AB#120092 Screen-reader fix fo data-only messages#269
sushmi21 wants to merge 3 commits intomainfrom
bug/120092-screen-reader-fix

Conversation

@sushmi21
Copy link
Copy Markdown
Collaborator

Success criteria

Please describe what should be possible after this change. List all individual items on a separate line.

  • Data-only messages should not be announced by screen-readers

How to test

Please describe the individual steps on how a peer can test your change.

Security

  • Possible injection vector
  • Authentication/Access controls touched
  • Sensitive Data could be exposed
  • XSS
  • Logging/Monitoring touched
  • Exchanges data with external systems
  • No security implications

Additional considerations

  • This PR might have performance implications

Documentation Considerations

These are hints for the documentation team to help write the docs.

Copilot AI review requested due to automatic review settings April 15, 2026 07:29
@graymalkin77
Copy link
Copy Markdown

graymalkin77 commented Apr 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@sushmi21 sushmi21 changed the title Screen-reader fix fo data-only messages AB#120092 Screen-reader fix fo data-only messages Apr 15, 2026
github-actions Bot added a commit that referenced this pull request Apr 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the screen-reader live region behavior so “data-only” messages don’t trigger announcements in the Webchat UI accessibility layer.

Changes:

  • Changed DOM text extraction fallback to return an empty string instead of announcing a generic default.
  • Updated the live-region component to only announce when extracted content is non-empty (otherwise stay silent).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/webchat-ui/utils/live-region-announcement.ts Returns empty string when no message DOM node is found (silence instead of generic fallback).
src/webchat-ui/components/presentational/ScreenReaderLiveRegion.tsx Skips setLiveMessage when cleaned text is empty to avoid announcing data-only messages.

Comment thread src/webchat-ui/utils/live-region-announcement.ts Outdated
Comment thread src/webchat-ui/components/presentational/ScreenReaderLiveRegion.tsx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the screen-reader live-region announcement logic in the Webchat UI to avoid announcing “data-only” (non-rendered) messages.

Changes:

  • Updated getTextFromDOM to return both extracted text and a flag indicating whether a matching DOM element was found.
  • Updated ScreenReaderLiveRegion to suppress announcements when the message element is not found and to only announce non-empty content.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/webchat-ui/utils/live-region-announcement.ts Changes getTextFromDOM to return { text, elementExists } instead of a plain string.
src/webchat-ui/components/presentational/ScreenReaderLiveRegion.tsx Uses the new DOM lookup result to decide whether to announce, and suppresses empty announcements.

Comment thread src/webchat-ui/components/presentational/ScreenReaderLiveRegion.tsx
Comment on lines +66 to +74
const domResult = getTextFromDOM(id);
if (domResult.elementExists) {
// Element exists in DOM but may have no accessible text
// For visible elements without text (like images), provide a generic announcement
text = cleanUpText(domResult.text || "A new message");
} else {
// Element doesn't exist - this is a data-only message that shouldn't be announced
text = "";
}
Comment on lines +91 to +93
if (!messageElement) {
return { text: "", elementExists: false }; // Element doesn't exist - data-only message
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants