Make WordPress Core


Ignore:
Timestamp:
07/31/2026 08:06:46 PM (2 months 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.

File:
1 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>
Note: See TracChangeset for help on using the changeset viewer.