Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

#66205 closed defect (bug) (fixed)

Minor accessibility improvements to network admin pages

Reported by: afercia Owned by: peterwilsoncc
Priority: normal Milestone: 7.2
Component: Networks and Sites Version:
Severity: normal Keywords: has-screenshots good-first-bug has-patch commit
Cc: Focuses: accessibility, multisite

Description

Discovered while experimenting #66015 on the network admin pages.

1
When input fields have descriptions, a well established accessibility pattern in the WordPress admin pages programmatically associates the descriptions with their related fields by the means of an aria-describedby attribute.

In the Network Setup page, two fields miss this association.

Note: don't do this on a production site:

  • Add define( 'WP_ALLOW_MULTISITE', true ); in your wp-config.php file.
  • Go to WP Admin > Tools > Network Setup.
  • Observe the two input fields 'Network Title' and 'Network Admin Email' in this page have descriptions.
  • Observe the descriptions are not associated with the fields.
  • See first screenshot.

2

  • Once you have created your test network, go to `wp-admin/my-sites.php'.
  • Check the headings hierarchy.
  • Observe the main H1 heading is followed by H3 headings.
  • For accessibility and good semantics, heading levels should not be skipped.
  • The H3 headings should be changed to H2.
  • The CSS should be adjusted to not introduce changes for these headings font size.
  • Note that on the my-sites.php page there is another 'Global Settings' H3 that is shown conditionally. It should be tested and changed to H2 as well.
  • See screenshot 2.

Attachments (2)

01 network setup.png​ (190.7 KB ) - added by afercia 6 weeks ago.
The Network Setup page
02 my sites.png​ (263.1 KB ) - added by afercia 6 weeks ago.
The My Sites page

Download all attachments as: .zip

Change History (6)

@afercia
6 weeks ago

The Network Setup page

@afercia
6 weeks ago

The My Sites page

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


6 weeks ago
#1

  • Keywords has-patch added

Summary

Two small accessibility fixes on the network admin screens, as described in the ticket.

Network Setup (network.php)
The "Network Title" and "Network Admin Email" fields have description text that isn't programmatically associated with the inputs. This adds an aria-describedby on each input, pointing at an id on its description paragraph (sitename-desc and email-desc), matching the pattern used elsewhere in wp-admin.

My Sites (my-sites.php)
The page's h1 is followed by h3 headings, which skips a level. The per-site heading and the conditional "Global Settings" heading are now h2. The ticket asks for the CSS to be adjusted so the font size doesn't change, but h2 and h3 share the same rule in common.css (font-size: 1.3em; margin: 1em 0), so no CSS change is needed. Nothing else in the admin stylesheets targets .my-sites h3.

Testing

Tested locally with the wordpress-develop Docker environment.

Network Setup

  1. Add define( 'WP_ALLOW_MULTISITE', true ); to wp-config.php. Don't do this on a production site.
  2. Go to Tools > Network Setup.
  3. Inspect the "Network Title" and "Network Admin Email" inputs. Each has an aria-describedby that matches the id of its description.

My Sites

  1. After creating a test network, go to wp-admin/my-sites.php.
  2. Check the heading order: h1, then h2 for each site, with no skipped levels.
  3. To check the conditional "Global Settings" heading, hook the myblogs_options filter and return some HTML when the context is global. It renders as an h2.
  4. Compare the computed styles of an h2 and an h3 in the same container. Font size, margin, weight and colour are identical, so there's no visual change.

phpcs passes on both files. No tests were added, as these are markup-only changes and no existing tests cover these screens.

#2 @afercia
6 weeks ago

  • Keywords commit added

​@johnjamesjacoby commented on ​PR #13819:


6 weeks ago
#3

I added a follow-up commit for the additional heading-level issue found on the Network Setup page.

The four section headings rendered across the two setup steps—“Addresses of Sites in your Network,” “Server Address,” “Network Details,” and “Enabling the Network”—now use h2 rather than h3. This corrects the hierarchy beneath the page's h1 without changing the visual presentation, because the admin styles apply the same typography and spacing to these h2 and h3 elements.

I also ran the focused PHP coding standards check for src/wp-admin/includes/network.php, which passes.

#4 @peterwilsoncc
6 weeks ago

  • Owner set to peterwilsoncc
  • Resolution → fixed
  • Status new → closed

In 64013:

Network and Sites: Improve a11y of network admin pages.

Improves the accessibility of two network/multisite related admin screens:

  • My sites: Converts site name and "Global Settings" (available via filter) headings to h2 to avoid skipping a heading level
  • Network setup:
    • associates fields with their descriptive text with aria-describedby attributes
    • converts section headings to h2 to avoid skipping a heading level

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13819

Props mitgiselle, johnjamesjacoby, afercia.
Fixes #66205.

Note: See TracTickets for help on using tickets.