Skip to content

feat: Vary live region politeness based on priority#50

Merged
smockle merged 4 commits intomainfrom
smockle/vary-live-region-politeness
Apr 22, 2026
Merged

feat: Vary live region politeness based on priority#50
smockle merged 4 commits intomainfrom
smockle/vary-live-region-politeness

Conversation

@smockle
Copy link
Copy Markdown
Collaborator

@smockle smockle commented Apr 22, 2026

Fixes #27

This PR updates the polyfill so priority: normal messages go to an aria-live: polite live-region and priority: high messages go to an aria-live: assertive live-region, to more closely align with the spec and mappings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the ariaNotify() polyfill to select different live-region hosts based on message priority, aligning behavior with current spec direction for polite vs assertive announcements.

Changes:

  • Split live region host selection into two custom element types: polite-live-region-* and assertive-live-region-*.
  • Introduce PoliteLiveRegionCustomElement / AssertiveLiveRegionCustomElement subclasses to set aria-live appropriately.
  • Update browser tests to assert routing via the correct live region host and that messages dispatch through it.
Show a summary per file
File Description
arianotify-polyfill.js Selects polite vs assertive custom live-region host based on message priority; defines dedicated custom element subclasses.
tests/web-test-runner/arianotify-polyfill.test.js Reworks tests to validate correct host type/ariaLive and handleMessage dispatch for both priorities.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

tests/web-test-runner/arianotify-polyfill.test.js:64

  • This test uses a fixed 300ms delay before asserting handleMessage was called, while the polyfill uses a 250ms sleep internally. The small buffer can cause intermittent failures; prefer polling for the expected call (with a reasonable timeout) or increase the wait to provide sufficient headroom.
      await new Promise((resolve) => setTimeout(resolve, 300));
      expect(calls).to.have.length(1);
  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread tests/web-test-runner/arianotify-polyfill.test.js Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread tests/web-test-runner/arianotify-polyfill.test.js Outdated
Comment thread tests/web-test-runner/arianotify-polyfill.test.js Outdated
Comment thread tests/web-test-runner/arianotify-polyfill.test.js Outdated
Comment thread tests/web-test-runner/arianotify-polyfill.test.js Outdated
Co-authored-by: Clay Miller <clay@smockle.com>
Comment thread tests/web-test-runner/arianotify-polyfill.test.js Outdated
Comment thread tests/web-test-runner/arianotify-polyfill.test.js Outdated
Co-authored-by: Clay Miller <clay@smockle.com>
@smockle smockle enabled auto-merge April 22, 2026 16:55
@smockle smockle changed the title Vary live region politeness based on priority feat: Vary live region politeness based on priority Apr 22, 2026
@smockle smockle changed the title feat: Vary live region politeness based on priority feat: Vary live region politeness based on priority Apr 22, 2026
@smockle smockle merged commit 0bf7572 into main Apr 22, 2026
6 checks passed
@smockle smockle deleted the smockle/vary-live-region-politeness branch April 22, 2026 18:25
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.

[Task] Vary live region politeness based on priority

3 participants