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

Don't report IAccessible alert events if there's no content. #9266

Merged
merged 2 commits into from Feb 13, 2019

Conversation

jcsteh
Copy link
Contributor

@jcsteh jcsteh commented Feb 13, 2019

Link to issue number:

Fixes #5657.

Summary of the issue:

In Firefox and Chrome, NVDA reports "alert" when an empty element with role="alert" is shown.

Description of how this pull request fixes the issue:

In IAccessible's event_alert, return early if there's no content.
As well as the childCount, we also check name and description, as these might be set using ARIA even on an alert with no children.

Testing performed:

In both Firefox and Chrome, tested with the following test cases.

Empty alert. When button is pressed, nothing is reported:
data:text/html,<div id="al" role="alert" hidden></div><button onClick="al.hidden = false;">Alert</button>

Alert with text content. When button is pressed, "alert text" is reported:
data:text/html,<div id="al" role="alert" hidden>text</div><button onClick="al.hidden = false;">Alert</button>

Alert with aria-label. When button is pressed, "label alert" is reported:
data:text/html,<div id="al" role="alert" aria-label="label" hidden></div><button onClick="al.hidden = false;">Alert</button>

Alert with aria-describedby. When button is pressed, "alert desc" is reported:
data:text/html,<div id="desc">desc</div><div id="al" role="alert" aria-describedby="desc" hidden></div><button onClick="al.hidden = false;">Alert</button>

Alert with button. When button outside the alert is pressed, "alert, inner button" is reported:
data:text/html,<div id="al" role="alert" hidden><button>inner</button></div><button onClick="al.hidden = false;">Alert</button>

Known issues with pull request:

There are obscure cases this won't catch like an alert containing an empty paragraph, but fixing that is somewhat trickier and I doubt it happens in the real world. If it does, we can extend this later.

Change log entry:

Bug Fixes:

- In Mozilla Firefox and Google Chrome, empty alerts are no longer reported.

As well as the childCount, we also check name and description, as these might be set using ARIA even on an alert with no children.
@michaelDCurran michaelDCurran merged commit 2c81a69 into nvaccess:master Feb 13, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.1 milestone Feb 13, 2019
@jcsteh jcsteh deleted the noEmptyAlert branch February 13, 2019 22:28
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.

NVDA incorrectly announces the presence of empty Alert live regions when dynamically added to the DOM
3 participants