cloudfour / cloudfour/pleasantest

Add options for testing aria-live announcements

Open
#431 2 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
TypeScript
Stars
175
Forks
2
Avg merge
1m
Merged PRs (30d)
1

Description

Assistive technologies use [`aria-live` regions](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) to announce important content changes to their users.

It would be great if Pleasantest exposed tools to help test aria live announcements. There are two approaches that could work:

**Adding a new assertion**

Something along these lines:

```js
await expect('Preparing Learning Path').toBeAnnounced();
```

**Adding more info to `getAccessibilityTree`**

Another option would be to expose aria live regions in the accessibility tree. Perhaps by adding `(aria-live)` after the role or something?

Then in your tests you could check the `aria-live` region before and after an action and see that the text had changed (And presume it had been announced)

If we went this way should we probably provide info about whether the mode is `polite` or `assertive`. In follow-up cards we could also look into supporting `aria-atomic`, `aria-relevant`, `aria-busy`, etc.

---

I'm not sure which of these I'd prefer from a test writing perspective. It would be awesome to have both options, but that obviously adds complexity. Either one could solve for this use case.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.