Make WordPress Core

Opened 7 weeks ago

Last modified 7 weeks ago

#63199 accepted enhancement

Allow to control aria-live attribute in settings_errors()

Reported by: andremenrath's profile andremenrath Owned by: joedolson's profile joedolson
Milestone: 6.9 Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: has-patch
Focuses: ui, accessibility Cc:

Description

Users using a screen reader get not properly noticed about admin notices added with the function add_settings_error().

The attribute aria-live could help to point the attention to settings errors in multiple levels.

https://developer.mozilla.org/de/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-live

Change History (3)

#1 @joedolson
7 weeks ago

  • Milestone changed from Awaiting Review to 6.9
  • Owner set to joedolson
  • Status changed from new to accepted
  • Version changed from 6.3.2 to 3.0

This is effectively a subset of the issue noted in #50486. This could be somewhat helped by adding role="alert", which can be used at initial load to trigger a notice being read. However, that is not reliable; the alert role is intended to be equivalent to aria-live="assertive", and is not intended by design to be read on page load, though some screen readers do.

What probably does make sense is for add_settings_error() to support all the same parameters already supported in wp_admin_notice(), and to use those functions to print output. This would also have the advantage that settings errors would be filterable.

I'm also noting that the output of added settings errors in settings_errors() wraps the message text in strong elements, which is not something we want, per the recently closed #50402.

This dates back to the addition of the function in version 3.0.0.

This ticket was mentioned in PR #8642 on WordPress/wordpress-develop by @abcd95.


7 weeks ago
#2

  • Keywords has-patch added

#3 @abcd95
7 weeks ago

I have attempted to make the add_settings_error() function support the parameters as wp_admin_notice() does. Now, regarding the latter part, the output wrapped in <strong>, I am not sure if we must remove the bold entirely or make specific parts bold, so I am waiting for some feedback on that.

Note: See TracTickets for help on using tickets.