Page MenuHomePhabricator

Create ARIA live region
Open, MediumPublic3 Estimated Story Points

Description

Background

Currently we don't have an available ARIA live region for dynamic content changes. This is important because screen readers scan the page at load time and register all live regions then. If there is a dynamic update that isn't within a live region, screen readers will not pick up on aria-live. If we create an aria live region within the html when a page is loaded we can then append information to it that we want screen readers to read. This is important for Reading List bc we want assistive technology users to know that they have successfully added articles to their reading list

User story

As a person who relies on assistive technology like screen readers to use the web, I want to be made aware of dynamic changes to content so that I am not confused or unsure of the current state of the application. As a Reading List users, I want to be notified that I have successfully added an article to my reading list so that I don't have to navigate to my reading list and check for the article there.

Former art

T55483: Add aria-live to mw.notification messages

Open questions

  • ✅ Evaluate polite vs assertive as value for the live region for notifications
    • 2025-09-24 @Volker_E: With some research and accessibility group feedback, polite seems like a solid choice
  • Evaluate accompanying aria-atomic attribute and value
    • 2025-10-29 @LMora-WMF With some research decided to leave aria-atomic to it's default setting of false
  • Which region(s) on the page should be live regions?
    • 2025-10-29 @LMora-WMF Keeping this scoped to notifications to not over engineer
  • From patch: Would it be possible to add the aria-live markup to the mw-notification-area element, instead of copying the text to another element?
    • 2025-10-29 @LMora-WMF using a live region separate from mw-notification-area follows best practices and separation of concerns. See comment below

Technical notes

Requirements / Acceptance Criteria

  • Within core, there is an ARIA live region that exists on initial page load.
  • ARIA live region has role="region" and aria-live="polite"

Requirement

Scope: MediaWiki core (desktop + mobile, all skins).

  • Introduce an ARIA live region that is available immediately upon initial page load.
  • The live region must be available to screen readers at all times and not hidden via display: none.
  • The live region must have the following attributes:
    • role="region"
    • aria-live="polite"
  • The live region should be separate from the mw-notification-area element to maintain clear separation of concerns.
  • The region will serve as the destination for dynamic notification messages (e.g., Reading List confirmation).
  • The live region must load with every page, even before any dynamic notifications occur.
  • aria-atomic should remain at its default (false).

BDD

Feature: Create an ARIA live region for dynamic notifications

  Scenario: Page loads with ARIA live region
    Given I load any page on the wiki
    When I inspect the page’s DOM structure
    Then an element exists with `role="region"` and `aria-live="polite"`
    And it is visible to assistive technology (not `display: none`)

  Scenario: Screen reader detects live region
    Given the ARIA live region exists on page load
    When a dynamic notification is triggered (e.g., a Reading List save message)
    Then the notification text is added to the live region
    And the message is read aloud by the screen reader

Test Steps

Test Case 1: Verify live region exists on page load

  1. Load any wiki page and open Chrome DevTools → Elements tab.
  2. Search for an element with role="region" and aria-live="polite".
  3. AC1: The live region is present in the DOM on initial page load.
  4. AC2: The live region is not hidden with display: none or visibility: hidden.

Test Case 2: Verify screen reader reads messages from live region

  1. Trigger a dynamic notification (e.g., save a page to Reading List).
  2. Inspect the live region content again in DevTools.
  3. AC3: The notification text appears inside the live region element.
  4. AC4: Using macOS VoiceOver, confirm that the text is read aloud automatically.

Event Timeline

  1. What region or regions of the HTML should receive the aria=live role specifically?
  2. What UI or content changes are we anticipating in those regions?
LMora-WMF renamed this task from Create ARIA live region for skins to Create ARIA live region.Jul 29 2025, 3:03 PM
LMora-WMF updated the task description. (Show Details)

Change #1185182 had a related patch set uploaded (by LorenMora; author: LorenMora):

[mediawiki/core@master] POC - Add aria-live region and us in notifications

https://gerrit.wikimedia.org/r/1185182

Volker_E updated the task description. (Show Details)
Volker_E subscribed.
LMora-WMF set the point value for this task to 3.Sep 8 2025, 7:49 PM
LMora-WMF moved this task from Backlog to Ready for sprint on the Reader Experience Team board.
Volker_E updated the task description. (Show Details)
SToyofuku-WMF subscribed.

This can go back to ready for sprint since it's already estimated/discussed

Change #1185182 abandoned by LorenMora:

[mediawiki/core@master] POC - Add aria-live region and us in notifications

Reason:

Merged master but not it's showing all these file changes. Will make a new, clean patch instead.

https://gerrit.wikimedia.org/r/1185182

Change #1199863 had a related patch set uploaded (by LorenMora; author: LorenMora):

[mediawiki/core@master] Create ARIA live region for notifications

https://gerrit.wikimedia.org/r/1199863

I looked into the suggestions of making .mw-notification-area a live region and decided against it for the following reasons.

  1. Separation of concerns: aria-live regions are typically invisible, off-screen elements dedicated solely to announcements, while the notification area is a visual UI component with animations, styles, click handlers.
  2. This is a pattern followed by other component libraries such as Bootstrap, Chakra, and Material UI
  3. .mw-notification-area is unreliable as a live region bc it is created client side. Thus it is not consistently available on page load when screen readers scan the page to track all elements. I tested this and aria-live doesn't work even after removing display: none from .mw-notification-area`. Moving it to server side would be a big lift that could cause breaking changes and complications.

Change #1185182 restored by LorenMora:

[mediawiki/core@master] POC - Add aria-live region and us in notifications

https://gerrit.wikimedia.org/r/1185182

Change #1199863 abandoned by LorenMora:

[mediawiki/core@master] Create ARIA live region for notifications

Reason:

thanks Tacsipacsi, I move these changes to the original POC patch

https://gerrit.wikimedia.org/r/1199863

Test wiki created on Patch demo by BWang (WMF) using patch(es) linked to this task:
https://86444fcec3.catalyst.wmcloud.org/w/

Test wiki on Patch demo by BWang (WMF) using patch(es) linked to this task was deleted:

https://86444fcec3.catalyst.wmcloud.org/w/

Test wiki created on Patch demo by BWang (WMF) using patch(es) linked to this task:
https://6dde77a545.catalyst.wmcloud.org/w/

Change #1201715 had a related patch set uploaded (by LorenMora; author: LorenMora):

[mediawiki/extensions/ReadingLists@master] Add ariaText to add/remove reading list item notification

https://gerrit.wikimedia.org/r/1201715

Change #1185182 merged by jenkins-bot:

[mediawiki/core@master] Create ARIA live region for notifications

https://gerrit.wikimedia.org/r/1185182

Change 1201715 can be ignored for this task as I created a new one for it. https://phabricator.wikimedia.org/T409223

Change #1202866 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] mediawiki.notification: Make id/class explicit and remove default values

https://gerrit.wikimedia.org/r/1202866

Change #1202866 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.notification: Make id/class explicit and remove default values

https://gerrit.wikimedia.org/r/1202866

Test wiki on [[ | Patch demo ]] by BWang (WMF) using patch(es) linked to this task was deleted:

https://6dde77a545.catalyst.wmcloud.org/w/

Test Result - Beta

Status: ✅ PASS / ❓Need More Info
Environment: beta/enwiki
OS: macOS Tahoe 26.x
Browser: Chrome Canary (latest as of test date)
Device: MS
Emulated Device: NA

Test Case 1: Verify live region exists on page load

  1. Load any wiki page and open Chrome DevTools → Elements tab.
  2. Search for an element with role="region" and aria-live="polite".
  3. AC1: The live region is present in the DOM on initial page load.
  4. AC2: The live region is not hidden with display: none or visibility: hidden.

Is this what you're looking for?

screenshot 21.png (1×1 px, 759 KB)

Test Case 2: Verify screen reader reads messages from live region

  1. Trigger a dynamic notification (e.g., save a page to Reading List).
  2. Inspect the live region content again in DevTools.
  3. AC3: The notification text appears inside the live region element.
  4. AC4: Using macOS VoiceOver, confirm that the text is read aloud automatically.

screenshot 27.mov.gif (1×1 px, 322 KB)