createAnnouncer
Create an owned browser announcer with progressive ariaNotify delivery, stable live-region fallback, diagnostics, and cleanup.
Signature and import
auto mode attempts ariaNotify when available, then falls back to the selected polite or assertive live region.
import { createAnnouncer } from "@generative-a11y/dom";
const announcer = createAnnouncer({
mode: "auto",
onDelivery(result) {
console.log(result.status, result.method);
},
});
const result = announcer.announce(intent);
// Call announcer.dispose() when the owning surface is removed.Walkthrough
Use progressive delivery
auto keeps the fallback available when ariaNotify is absent or throws.
Observe the attempt
DeliveryResult reports the browser action without making a speech claim.
Release owned nodes
Dispose removes only live regions created by this announcer.
Prop
Type
AnnouncerOptions
Supplying regions transfers neither node ownership nor removal responsibility to the library.
Prop
Type
DeliveryResult
announce returns one result synchronously.
| Status | Method | Meaning |
|---|---|---|
| notified | aria-notify | ariaNotify returned without throwing |
| mutated | live-region | Selected stable region text changed |
| unavailable | none | No usable document or region exists |
| disposed | none | announce was called after disposal |
Prop
Type
Evidence and testing note
A notified or mutated result confirms that the library updated the browser. Test with a real screen reader to confirm what it speaks.