Skip to content

v1.1.1

Choose a tag to compare

@patrickfox patrickfox released this 10 Sep 03:15
· 17 commits to master since this release
04e3d9b

The final 1.x release. Backports the repeated-announcement fix from 2.0 so it is available without the breaking inert change.

ariaHide() and ariaUnhide() are byte-identical to 1.1.0. The only runtime change is announce().

Fixed

Announcing the same message twice in a row was silent.

Screen readers suppress text they have just spoken, independently of the DOM. The live region empties itself 500ms after each announcement, so a later repeat is a genuine change from empty to text — and was dropped anyway, which is what ruled out every DOM-shaped explanation.

announce() now appends a non-breaking space to every other repeat. It is not spoken; it only makes consecutive announcements textually distinct.

This matters for ordinary cases like announcing "Item added to cart" twice, where the second one simply never reached the user.

How the fix was chosen

Measured on VoiceOver across seven candidate strategies rather than picked:

Strategy Result
Write the same string again silent
Empty it, write back on a later task silent
Cycle aria-live off and back silent
Replace the child node silent
Alternate a zero-width space silent
Alternate between two live regions spoke, but only once per region
Alternate a non-breaking space spoke

U+200B is stripped from the accessible name, while U+00A0 counts as content. Alternating two regions appeared to work but gives each region only one pass before hitting the same suppression, so it defers the problem rather than fixing it.

Note

announce() returns the live region, so its textContent may carry a trailing non-breaking space. Compare with .trim() if you assert on it.

Staying on 1.x

Pin "^1.1.1" and npm will not offer you 2.0.

2.0 changes ariaHide() to use native inert, which fixes limitations that cannot be addressed in the 1.x approach — content added to a subtree after hiding stayed tabbable, and shadow DOM was never traversed. It changes what ariaHide() writes to the DOM, so it only affects you if you assert on aria-hidden or style with [aria-hidden="true"]. See the migration guide in the README.

Full changelog: v1.1.0...v1.1.1