WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#46995 closed enhancement (invalid)

Notifications need ARIA `role` attribute of either `status` or `alert` for accessibility purposes

Reported by: dannylonglegs Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords:
Focuses: accessibility Cc:

Description

During a recent accessibility audit at Pressbooks, we were informed that in order for notifications to be accessible, they need and ARIA role of either status or alert.

role=alert documentation:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Alert_Role

role=status documentation:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_status_role

Examples in WP code:
https://github.com/WordPress/WordPress/blob/355d5f9bb76bff0a24970cea8a5be22d9ed612d4/wp-admin/themes.php#L203

https://github.com/WordPress/WordPress/blob/355d5f9bb76bff0a24970cea8a5be22d9ed612d4/wp-admin/import.php#L63-L71

These HTML elements, usually with the id="message" or class="error" should have ARIA roles.

Change History (6)

#1 @SergeyBiryukov
3 months ago

  • Component changed from General to Administration

#2 @SergeyBiryukov
3 months ago

  • Focuses accessibility added

#3 @afercia
3 months ago

@dannylonglegs thanks for your report. It's important to note that role=status and role=alert are a specialized type of live regions. That is to say that using these roles on notifications that are rendered on page load won't have any effect. Assistive technologies won't announce the notifications content.

Reference:
https://www.w3.org/TR/wai-aria-1.1/#alert
https://www.w3.org/TR/wai-aria-1.1/#status

Quoting from the Aria Authoring Practices (emphasis mine):

Dynamically rendered alerts are automatically announced by most screen readers, and in some operating systems, they may trigger an alert sound. It is important to note that, at this time, screen readers do not inform users of alerts that are present on the page before page load completes.

W3C role=alert example:
https://www.w3.org/TR/wai-aria-practices/examples/alert/alert.html

The standard admin notices in WordPress are rendered during page load. They're usually placed close to the main H1 heading so, in a way, screen reader users can find them with some content exploration. Any suggestions to improve their discoverability after page load is very welcome. I guess there should be a standardized way to generate the notices to start with.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


3 months ago

#5 @afercia
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 5.1.1 deleted

Discussed during today's accessibility bug scrub and agreed to close this ticket because "static" notifications rendered on page load won't benefit from an ARIA alert or status role.

Also, agreed to create a new ticket to address all the "dynamic" notifications, that is the ones that are rendered in the DOM "on the fly" and do need ARIA roles.

#6 @afercia
3 months ago

Follow up: #47111.

Note: See TracTickets for help on using tickets.