WordPress.org

Make WordPress Core

Changeset 35316


Ignore:
Timestamp:
10/21/2015 03:56:22 AM (5 years ago)
Author:
wonderboymusic
Message:

Export: add missing labels and improvement accessibility of the Export screen.

Props afercia.
Fixes #33046.

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

Legend:

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

    r35315 r35316  
    754754}
    755755
     756.label-responsive {
     757    vertical-align: middle;
     758}
     759
     760#export-filters p {
     761    margin: 0 0 1em;
     762}
     763
     764#export-filters p.submit {
     765    margin: 7px 0 5px;
     766}
     767
    756768/* Card styles */
    757769
     
    11111123
    11121124    .form-table th,
    1113     .form-table td {
     1125    .form-table td,
     1126    .label-responsive {
    11141127        display: block;
    11151128        width: auto;
    11161129        vertical-align: middle;
     1130    }
     1131
     1132    .label-responsive {
     1133        margin: 0.5em 0;
     1134    }
     1135
     1136    .export-filters li {
     1137        margin-bottom: 0;
    11171138    }
    11181139
  • trunk/src/wp-admin/export.php

    r34326 r35316  
    9393    } elseif ( 'attachment' == $_GET['content'] ) {
    9494        $args['content'] = 'attachment';
    95        
     95
    9696        if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
    9797            $args['start_date'] = $_GET['attachment_start_date'];
    9898            $args['end_date'] = $_GET['attachment_end_date'];
    9999        }
    100     } 
     100    }
    101101    else {
    102102        $args['content'] = $_GET['content'];
     
    161161<h2><?php _e( 'Choose what to export' ); ?></h2>
    162162<form method="get" id="export-filters">
     163<fieldset>
     164<legend class="screen-reader-text"><?php _e( 'Content to export' ); ?></legend>
    163165<input type="hidden" name="download" value="true" />
    164 <p><label><input type="radio" name="content" value="all" checked="checked" /> <?php _e( 'All content' ); ?></label></p>
    165 <p class="description"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus, and custom posts.' ); ?></p>
     166<p><label><input type="radio" name="content" value="all" checked="checked" aria-describedby="all-content-desc" /> <?php _e( 'All content' ); ?></label></p>
     167<p class="description" id="all-content-desc"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.' ); ?></p>
    166168
    167169<p><label><input type="radio" name="content" value="posts" /> <?php _e( 'Posts' ); ?></label></p>
    168170<ul id="post-filters" class="export-filters">
    169171    <li>
    170         <label><?php _e( 'Categories:' ); ?></label>
     172        <label><span class="label-responsive"><?php _e( 'Categories:' ); ?></span>
    171173        <?php wp_dropdown_categories( array( 'show_option_all' => __('All') ) ); ?>
    172     </li>
    173     <li>
    174         <label><?php _e( 'Authors:' ); ?></label>
    175 <?php
     174        </label>
     175    </li>
     176    <li>
     177        <label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
     178        <?php
    176179        $authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" );
    177180        wp_dropdown_users( array( 'include' => $authors, 'name' => 'post_author', 'multi' => true, 'show_option_all' => __('All') ) );
    178 ?>
    179     </li>
    180     <li>
    181         <label><?php _e( 'Date range:' ); ?></label>
    182         <select name="post_start_date">
    183             <option value="0"><?php _e( 'Start Date' ); ?></option>
     181        ?>
     182        </label>
     183    </li>
     184    <li>
     185        <fieldset>
     186        <legend class="screen-reader-text"><?php _e( 'Date range:' ); ?></legend>
     187        <label for="post-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
     188        <select name="post_start_date" id="post-start-date">
     189            <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    184190            <?php export_date_options(); ?>
    185191        </select>
    186         <select name="post_end_date">
    187             <option value="0"><?php _e( 'End Date' ); ?></option>
     192        <label for="post-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
     193        <select name="post_end_date" id="post-end-date">
     194            <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    188195            <?php export_date_options(); ?>
    189196        </select>
    190     </li>
    191     <li>
    192         <label><?php _e( 'Status:' ); ?></label>
    193         <select name="post_status">
     197        </fieldset>
     198    </li>
     199    <li>
     200        <label for="post-status" class="label-responsive"><?php _e( 'Status:' ); ?></label>
     201        <select name="post_status" id="post-status">
    194202            <option value="0"><?php _e( 'All' ); ?></option>
    195203            <?php $post_stati = get_post_stati( array( 'internal' => false ), 'objects' );
     
    204212<ul id="page-filters" class="export-filters">
    205213    <li>
    206         <label><?php _e( 'Authors:' ); ?></label>
    207 <?php
     214        <label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
     215        <?php
    208216        $authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'" );
    209217        wp_dropdown_users( array( 'include' => $authors, 'name' => 'page_author', 'multi' => true, 'show_option_all' => __('All') ) );
    210 ?>
    211     </li>
    212     <li>
    213         <label><?php _e( 'Date range:' ); ?></label>
    214         <select name="page_start_date">
    215             <option value="0"><?php _e( 'Start Date' ); ?></option>
     218        ?>
     219        </label>
     220    </li>
     221    <li>
     222        <fieldset>
     223        <legend class="screen-reader-text"><?php _e( 'Date range:' ); ?></legend>
     224        <label for="page-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
     225        <select name="page_start_date" id="page-start-date">
     226            <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    216227            <?php export_date_options( 'page' ); ?>
    217228        </select>
    218         <select name="page_end_date">
    219             <option value="0"><?php _e( 'End Date' ); ?></option>
     229        <label for="page-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
     230        <select name="page_end_date" id="page-end-date">
     231            <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    220232            <?php export_date_options( 'page' ); ?>
    221233        </select>
    222     </li>
    223     <li>
    224         <label><?php _e( 'Status:' ); ?></label>
    225         <select name="page_status">
     234        </fieldset>
     235    </li>
     236    <li>
     237        <label for="page-status" class="label-responsive"><?php _e( 'Status:' ); ?></label>
     238        <select name="page_status" id="page-status">
    226239            <option value="0"><?php _e( 'All' ); ?></option>
    227240            <?php foreach ( $post_stati as $status ) : ?>
     
    235248<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>
    236249<?php endforeach; ?>
     250
    237251<p><label><input type="radio" name="content" value="attachment" /> <?php _e( 'Media' ); ?></label></p>
    238252<ul id="attachment-filters" class="export-filters">
    239253    <li>
    240         <label><?php _e( 'Date range:' ); ?></label>
    241         <select name="attachment_start_date">
    242             <option value="0"><?php _e( 'Start Date' ); ?></option>
     254        <fieldset>
     255        <legend class="screen-reader-text"><?php _e( 'Date range:' ); ?></legend>
     256        <label for="attachment-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
     257        <select name="attachment_start_date" id="attachment-start-date">
     258            <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    243259            <?php export_date_options( 'attachment' ); ?>
    244260        </select>
    245         <select name="attachment_end_date">
    246             <option value="0"><?php _e( 'End Date' ); ?></option>
     261        <label for="attachment-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
     262        <select name="attachment_end_date" id="attachment-end-date">
     263            <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    247264            <?php export_date_options( 'attachment' ); ?>
    248265        </select>
     266        </fieldset>
    249267    </li>
    250268</ul>
     269
     270</fieldset>
    251271<?php
    252272/**
    253  * Fires after the export filters form.
     273 * Fires at the end of the export filters form.
    254274 *
    255275 * @since 3.5.0
Note: See TracChangeset for help on using the changeset viewer.