npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aria-live-capture

v2.0.0

Published

Capture announcements of ARIA-live regions

Downloads

2,777

Readme

aria-live-capture

Installation | Usage | Announcement detection examples | Support

Capture announcements of ARIA live regions.

aria-live-capture is an utility tool for inspecting announcements of ARIA live regions. When developing an application which utilizes ARIA live announcements it is often frustrating to toggle screen readers and other assistive technologies constantly on/off during development. This tool aims to help developers easily see announcements without having to use actual screen readers. However final assertion should always be made with the actual target assistive technology.

For online demo see Storybook playground.

For validating ARIA live regions in tests see extend-to-be-announced.

For Storybook integration see storybook-addon-aria-live.

Read more about inspiration from Building testing tools for ARIA live regions.

Installation

aria-live-capture should be included in development dependencies.

npm install --save-dev aria-live-capture

Usage

Import CaptureAnnouncements from entrypoint.

import CaptureAnnouncements from 'aria-live-capture';

onCapture

Pass onCapture callback to handle announcements.

| Callback argument | type | value | | :---------------: | :------: | -------------------------------- | | announcement | string | Text content of the announcement | | politenessSetting | string | polite\|assertive |

CaptureAnnouncements({
    onCapture: (announcement, politenessSetting) => {
        console.log(`"${announcement}" was announced with politeness setting "${politenessSetting}"`);
    },
});
"Loading" was announced with politeness setting "polite"
"Failed to load user details" was announced with politeness setting "assertive"

includeShadowDom

Pass an optional boolean includeShadowDom option to include tracking of live regions in Shadow DOM. Default value is false.

CaptureAnnouncements({
    includeShadowDom: true,
});

cleanup

The CaptureAnnouncements method returns cleanup function for clearing DOM interceptors.

const cleanup = CaptureAnnouncements(options);

cleanup();

Announcement detection examples

Test online  

Render#1 | <div role="status"></div>
Render#2 | <div role="status">Loading</div>
PASS ✅  | "Loading" is announced
Render#1 | <div aria-live="polite"></div>
Render#2 | <div aria-live="polite">Loading</div>
PASS ✅  | "Loading" is announced
Render#1 | <div role="log"></div>
Render#2 | <div role="log">Loading</div>
PASS ✅  | "Loading" is announced
Render#1 | <output></output>
Render#2 | <output>Loading</output>
PASS ✅  | "Loading" is announced
Render#1 | <div role="status">Loading</div>
FAIL ❌  | "Loading" is not announced
Render#1 | <div></div>
Render#2 | <div role="status">Loading</div>
FAIL ❌  | "Loading" is not announced
Render#1 | <div></div>
Render#2 | <div aria-live="polite">Loading</div>
FAIL ❌  | "Loading" is not announced
Render#1 | <div role="alert">Error</div>
PASS ✅  | "Error" is announced
Render#1 | <div aria-live="assertive">Error</div>
FAIL ❌  | "Error" is not announced
Render#1 | <div></div>
Render#2 | <div role="alert">Error</div>
PASS ✅  | "Error" is announced
Render#1 | <div role="status">
         |     <div aria-hidden="true">Loading</div>
         | </div>
         |
Render#2 | <div role="status">
         |     <div aria-hidden="false">Loading</div>
         | </div>
         |
PASS ✅  | "Loading" is announced
Render#1 | <div role="status" aria-hidden="true">Loading</div>
Render#2 | <div role="status" aria-hidden="false">Loading</div>
FAIL ❌  | "Loading" is not announced

With option { includeShadowDom: true }:

Render#1 | <div role="status">
         |     #shadow-root
         |     <div></div>
         | </div>
         |
Render#2 | <div role="status">
         |     #shadow-root
         |     <div>Loading</div>
         | </div>
         |
PASS ✅  | "Loading" is announced

Support

| Feature | Status | | :-------------: | :----: | | role | ✅ | | aria-live | ✅ | | aria-atomic | ❌ 👷 | | aria-busy | ❌ | | aria-relevant | ❌ |