Make WordPress Core

Changeset 62961


Ignore:
Timestamp:
07/31/2026 08:06:46 PM (6 weeks ago)
Author:
joedolson
Message:

Accessibility: Fix labels in discussion and reading settings.

Items per page, items per feed, and comment link moderation settings used inappropriate structures. For posts per page and items per feed, the label was missing context, provided in an orphaned text string; for the comment link moderation settings, the label used a sentence structure that created mis-ordered labeling for screen reader users. The labels also use numeric interpolations that should require handling plural and singular translations separately.

Alter structure to use appropriate combinations of label and aria-describedy structures, making the labeling more consistent and accessible. Restructures text to remove the need for alternate translations based on number.

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

Props pavelevap, garyj, sergeybiryukov, shailu25, wildworks, johnbillion, chriscct7, afercia, garrett-eclipse, joedolson.
Fixes #29299.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options-discussion.php

    r62710 r62961  
    183183<th scope="row"><?php echo $comment_moderation_title; ?></th>
    184184<td><fieldset><legend class="screen-reader-text"><span><?php echo $comment_moderation_title; ?></span></legend>
    185 <p><label for="comment_max_links">
    186 <?php
    187 printf(
    188         /* translators: %s: Number of links. */
    189         __( 'Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)' ),
    190         '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr( get_option( 'comment_max_links' ) ) . '" class="small-text" />'
    191 );
    192 ?>
    193 </label></p>
     185<p><label for="comment_max_links"><?php _e( 'Number of links to allow in a comment before holding for moderation:' ); ?></label>
     186<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="<?php echo esc_attr( get_option( 'comment_max_links' ) ); ?>" class="small-text" aria-describedby="comment_links_moderation_desc" />
     187<span id="comment_links_moderation_desc"><?php _e( '(A common characteristic of comment spam is a large number of hyperlinks.)' ); ?></span>
     188</p>
    194189
    195190<p><label for="moderation_keys"><?php _e( 'When a comment contains any of these words in its content, author name, URL, email, IP address, or browser&#8217;s user agent string, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP address per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.' ); ?></label></p>
  • trunk/src/wp-admin/options-reading.php

    r62089 r62961  
    176176<?php endif; ?>
    177177<tr>
    178 <th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
     178<th scope="row"><label for="posts_per_page"><?php _e( 'Number of recent posts shown on archive pages' ); ?></label></th>
    179179<td>
    180 <input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" /> <?php _e( 'posts' ); ?>
     180<input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" />
    181181</td>
    182182</tr>
    183183<tr>
    184 <th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th>
    185 <td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
     184<th scope="row"><label for="posts_per_rss"><?php _e( 'Number of recent items shown in syndication feeds' ); ?></label></th>
     185<td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /></td>
    186186</tr>
    187187
Note: See TracChangeset for help on using the changeset viewer.