Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#66302 new defect (bug)

Make all admin notices render after the main H1 heading

Reported by: afercia Owned by:
Priority: normal Milestone: Future Release
Component: Administration Version:
Severity: normal Keywords: has-patch
Cc: Focuses: accessibility

Description

Related: #50486 / [64282]

Many important admin notices (see a few examples in the attached screenshot) render before the page main H1 heading.

I do realize they are rendered at the very top of the page to be visually prominent. However, this has a few important disadvantages:

  • These notices may be entirely missed by screen reader users, as they come after the main H1 heading. Many users may jump directly to the H1 and miss anything that comes before it.
  • It's not a case that an important accessibility best practice requires the main H1 heading to be the very first thing inside the <main> element.
  • These notices aren't moved to the <aside> element added in #50486. As such, they are separated from other notices and aren't included in an ARIA landmark.

Basically, to my understanding, all the notices hooked to:

  • network_admin_notices
  • user_admin_notices
  • admin_notices
  • all_admin_notices

stay before the main H1 heading if they use the additional CSS class inline.

It is worth reminding that the admin notices that do not use the inline CSS class are moved via Javascript after the H1.

I'd like to propose to remove the inline CSS class from all these notices.

Visual prominence can be achieved by other means, for example with a good usage of white space.

This proposal is not related to 'inline' notices that are intentionally rendered in the middle of the page.

Attachments (1)

01 notices inline before h1.png​ (170.6 KB ) - added by afercia 5 weeks ago.

Download all attachments as: .zip

Change History (6)

#1 @afercia
5 weeks ago

  • Summary Male all admin notices render after the main H1 heading → Make all admin notices render after the main H1 heading

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


5 weeks ago

#3 @joedolson
5 weeks ago

I think that the slight additional visual prominence that comes from being above the h1 isn't worth the loss of accessibility and consistency from having these notices in different positions, so I think this is a good idea.

The difference in visual prominence is very nominal, to my eyes, and not worth preserving.

This ticket was mentioned in ​PR #14252 on ​WordPress/wordpress-develop by ​@iamadisingh.


5 weeks ago
#4

  • Keywords has-patch added

Four core notices on admin_notices / network_admin_notices use the inline class, so moveAdminNotices() from 64282 skips them and they render before the main H1, outside aside#wp-admin-notices.

This patch removes inline from:

  • update_nag() — update available notice
  • maintenance_nag() — failed update notice
  • site_admin_notice() — "Upgrade Network" notice
  • WP_Privacy_Policy_Content::notice() — privacy policy guide notice

It also adds #wp-admin-notices .update-nag { display: block; }, since .update-nag is inline-block and two nags would otherwise sit side by side inside the landmark.

About screens hide notices inside .about__container, so the "Upgrade Network" notice no longer shows on network/about.php?updated (it still shows on all other network screens).

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Sonnet 5.5
Used for: Drafting the fix and PR description; final implementation and verification reviewed by me.

#5 @joedolson
5 weeks ago

  • Milestone 7.2 → Future Release

Moving this to future release along with #50486; it should probably be followed up in #43484.

Note: See TracTickets for help on using tickets.