Skip to content

Commit ba1177b

Browse files
committed
Export: add missing labels and improvement accessibility of the Export screen.
Props afercia. Fixes #33046. git-svn-id: https://develop.svn.wordpress.org/trunk@35316 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6f6c0eb commit ba1177b

2 files changed

Lines changed: 73 additions & 32 deletions

File tree

src/wp-admin/css/forms.css

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,18 @@ table.form-table td .updated p {
753753
line-height: 24px;
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

758770
.card {
@@ -1110,12 +1122,21 @@ table.form-table td .updated p {
11101122
}
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;
11171130
}
11181131

1132+
.label-responsive {
1133+
margin: 0.5em 0;
1134+
}
1135+
1136+
.export-filters li {
1137+
margin-bottom: 0;
1138+
}
1139+
11191140
.form-table .color-palette td {
11201141
display: table-cell;
11211142
width: 15px;

src/wp-admin/export.php

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ function export_add_js() {
9292
$args['status'] = $_GET['page_status'];
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'];
103103
}
@@ -160,37 +160,45 @@ function export_date_options( $post_type = 'post' ) {
160160

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') ) ); ?>
174+
</label>
172175
</li>
173176
<li>
174-
<label><?php _e( 'Authors:' ); ?></label>
175-
<?php
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-
?>
181+
?>
182+
</label>
179183
</li>
180184
<li>
181-
<label><?php _e( 'Date range:' ); ?></label>
182-
<select name="post_start_date">
183-
<option value="0"><?php _e( 'Start Date' ); ?></option>
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>
197+
</fieldset>
190198
</li>
191199
<li>
192-
<label><?php _e( 'Status:' ); ?></label>
193-
<select name="post_status">
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' );
196204
foreach ( $post_stati as $status ) : ?>
@@ -203,26 +211,31 @@ function export_date_options( $post_type = 'post' ) {
203211
<p><label><input type="radio" name="content" value="pages" /> <?php _e( 'Pages' ); ?></label></p>
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-
?>
218+
?>
219+
</label>
211220
</li>
212221
<li>
213-
<label><?php _e( 'Date range:' ); ?></label>
214-
<select name="page_start_date">
215-
<option value="0"><?php _e( 'Start Date' ); ?></option>
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>
234+
</fieldset>
222235
</li>
223236
<li>
224-
<label><?php _e( 'Status:' ); ?></label>
225-
<select name="page_status">
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 ) : ?>
228241
<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
@@ -234,23 +247,30 @@ function export_date_options( $post_type = 'post' ) {
234247
<?php foreach ( get_post_types( array( '_builtin' => false, 'can_export' => true ), 'objects' ) as $post_type ) : ?>
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
256276
*/

0 commit comments

Comments
 (0)