Make WordPress Core

Changeset 53745


Ignore:
Timestamp:
07/21/2022 09:02:52 AM (2 years ago)
Author:
audrasjb
Message:

Administration: Add labels to read-only form fields.

This changeset improves admin forms accessibility by adding labels to the following read-only form fields:

  • Network setup screen: new visible label to the four textareas for code users need to paste into their wp-config file and the server configuration file (web.config or .htaccess).
  • setup-config.php: new visible label to one textarea for code to include in the wp-config file manually.
  • Admin toolbar: adds an arial-label attribute to the old "shortlink" feature (not used anymore but still activable by plugins).

Props sabernhardt, audrasjb, ryokuhi, joedolson.
Fixes #54302.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/forms.css

    r53710 r53745  
    11311131}
    11321132
     1133.configuration-rules-label {
     1134    font-weight: 600;
     1135    margin-bottom: 4px;
     1136}
     1137
    11331138/*------------------------------------------------------------------------------
    11341139   Credentials check dialog for Install and Updates
  • trunk/src/wp-admin/includes/network.php

    r51979 r53745  
    471471    ?>
    472472    <ol>
    473         <li><p>
     473        <li><p id="network-wpconfig-rules-description">
    474474        <?php
    475475        printf(
     
    487487        ?>
    488488        </p>
    489         <textarea class="code" readonly="readonly" cols="100" rows="7">
     489        <p class="configuration-rules-label"><label for="network-wpconfig-rules">
     490            <?php
     491            printf(
     492                /* translators: %s: File name (wp-config.php, .htaccess or web.config). */
     493                __( 'Network configuration rules for %s' ),
     494                '<code>wp-config.php</code>'
     495            );
     496            ?>
     497        </label></p>
     498        <textarea id="network-wpconfig-rules" class="code" readonly="readonly" cols="100" rows="7" aria-describedby="network-wpconfig-rules-description">
    490499define( 'MULTISITE', true );
    491500define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> );
     
    527536            $num_keys_salts = count( $keys_salts );
    528537            ?>
    529         <p>
     538        <p id="network-wpconfig-authentication-description">
    530539            <?php
    531540            if ( 1 === $num_keys_salts ) {
     
    545554            <?php _e( 'To make your installation more secure, you should also add:' ); ?>
    546555        </p>
    547         <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
     556        <p class="configuration-rules-label"><label for="network-wpconfig-authentication"><?php _e( 'Network configuration authentication keys' ); ?></label></p>
     557        <textarea id="network-wpconfig-authentication" class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>" aria-describedby="network-wpconfig-authentication-description"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
    548558            <?php
    549559        }
     
    604614';
    605615
    606             echo '<li><p>';
     616            echo '<li><p id="network-webconfig-rules-description">';
    607617            printf(
    608618                /* translators: 1: File name (.htaccess or web.config), 2: File path. */
     
    616626        }
    617627        ?>
    618         <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?></textarea>
     628            <p class="configuration-rules-label"><label for="network-webconfig-rules">
     629                <?php
     630                printf(
     631                    /* translators: %s: File name (wp-config.php, .htaccess or web.config). */
     632                    __( 'Network configuration rules for %s' ),
     633                    '<code>web.config</code>'
     634                );
     635                ?>
     636            </label></p>
     637            <textarea id="network-webconfig-rules" class="code" readonly="readonly" cols="100" rows="20" aria-describedby="network-webconfig-rules-description"><?php echo esc_textarea( $web_config_file ); ?></textarea>
    619638        </li>
    620639    </ol>
     
    657676EOF;
    658677
    659         echo '<li><p>';
     678        echo '<li><p id="network-htaccess-rules-description">';
    660679        printf(
    661680            /* translators: 1: File name (.htaccess or web.config), 2: File path. */
     
    669688        }
    670689        ?>
    671         <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"><?php echo esc_textarea( $htaccess_file ); ?></textarea>
     690            <p class="configuration-rules-label"><label for="network-htaccess-rules">
     691                <?php
     692                printf(
     693                    /* translators: %s: File name (wp-config.php, .htaccess or web.config). */
     694                    __( 'Network configuration rules for %s' ),
     695                    '<code>.htaccess</code>'
     696                );
     697                ?>
     698            </label></p>
     699            <textarea id="network-htaccess-rules" class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>" aria-describedby="network-htaccess-rules-description"><?php echo esc_textarea( $htaccess_file ); ?></textarea>
    672700        </li>
    673701    </ol>
  • trunk/src/wp-admin/setup-config.php

    r53458 r53745  
    394394            setup_config_display_header();
    395395            ?>
    396     <p>
     396<p>
    397397            <?php
    398398            /* translators: %s: wp-config.php */
     
    400400            ?>
    401401</p>
    402 <p>
     402<p id="wp-config-description">
    403403            <?php
    404404            /* translators: %s: wp-config.php */
     
    412412            ?>
    413413</p>
    414 <textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php echo $config_text; ?></textarea>
     414<p class="configuration-rules-label"><label for="wp-config">
     415            <?php
     416            /* translators: %s: wp-config.php */
     417            printf( __( 'Configuration rules for %s:' ), '<code>wp-config.php</code>' );
     418            ?>
     419    </label></p>
     420<textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly" aria-describedby="wp-config-description"><?php echo $config_text; ?></textarea>
    415421<p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the installation&#8221;.' ); ?></p>
    416422<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p>
  • trunk/src/wp-includes/admin-bar.php

    r53100 r53745  
    725725    }
    726726
    727     $html = '<input class="shortlink-input" type="text" readonly="readonly" value="' . esc_attr( $short ) . '" />';
     727    $html = '<input class="shortlink-input" type="text" readonly="readonly" value="' . esc_attr( $short ) . '" aria-label="' . __( 'Shortlink' ) . '" />';
    728728
    729729    $wp_admin_bar->add_node(
Note: See TracChangeset for help on using the changeset viewer.