Accessibility: Improve the Post Attributes meta box fields labels.

With [38951] the support for custom page templates has been extended to all post
types. By making the visible meta box titles real labels, accessibility improves
for all users and form fields have meaningful labels.

Fixes #38790.

Built from https://develop.svn.wordpress.org/trunk@39247


git-svn-id: http://core.svn.wordpress.org/trunk@39187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2016-11-15 16:01:30 +00:00
parent 36ac7287b0
commit dff34d5988
6 changed files with 26 additions and 15 deletions

View File

@ -628,6 +628,15 @@ span.wp-media-buttons-icon:before {
width: 250px; width: 250px;
} }
.post-attributes-label-wrapper {
margin-bottom: 0.5em;
}
.post-attributes-label {
vertical-align: baseline;
font-weight: 600;
}
#post-visibility-select { #post-visibility-select {
line-height: 1.5em; line-height: 1.5em;
margin-top: 3px; margin-top: 3px;

File diff suppressed because one or more lines are too long

View File

@ -628,6 +628,15 @@ span.wp-media-buttons-icon:before {
width: 250px; width: 250px;
} }
.post-attributes-label-wrapper {
margin-bottom: 0.5em;
}
.post-attributes-label {
vertical-align: baseline;
font-weight: 600;
}
#post-visibility-select { #post-visibility-select {
line-height: 1.5em; line-height: 1.5em;
margin-top: 3px; margin-top: 3px;

File diff suppressed because one or more lines are too long

View File

@ -813,8 +813,7 @@ function page_attributes_meta_box($post) {
$pages = wp_dropdown_pages( $dropdown_args ); $pages = wp_dropdown_pages( $dropdown_args );
if ( ! empty($pages) ) : if ( ! empty($pages) ) :
?> ?>
<p><strong><?php _e('Parent') ?></strong></p> <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p>
<label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label>
<?php echo $pages; ?> <?php echo $pages; ?>
<?php <?php
endif; // end empty pages check endif; // end empty pages check
@ -823,9 +822,9 @@ function page_attributes_meta_box($post) {
if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) : if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) :
$template = ! empty( $post->page_template ) ? $post->page_template : false; $template = ! empty( $post->page_template ) ? $post->page_template : false;
?> ?>
<p><strong><?php _e('Template') ?></strong><?php <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label><?php
/** /**
* Fires immediately after the heading inside the 'Template' section * Fires immediately after the label inside the 'Template' section
* of the 'Page Attributes' meta box. * of the 'Page Attributes' meta box.
* *
* @since 4.4.0 * @since 4.4.0
@ -835,12 +834,6 @@ function page_attributes_meta_box($post) {
*/ */
do_action( 'page_attributes_meta_box_template', $template, $post ); do_action( 'page_attributes_meta_box_template', $template, $post );
?></p> ?></p>
<label class="screen-reader-text" for="page_template">
<?php
$post_type_object = get_post_type_object( $post->post_type );
echo esc_html( $post_type_object->labels->attributes );
?>
</label>
<select name="page_template" id="page_template"> <select name="page_template" id="page_template">
<?php <?php
/** /**
@ -859,8 +852,8 @@ $default_title = apply_filters( 'default_page_template_title', __( 'Default Tem
</select> </select>
<?php endif; ?> <?php endif; ?>
<?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?> <?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?>
<p><strong><?php _e('Order') ?></strong></p> <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="menu_order"><?php _e( 'Order' ); ?></label></p>
<p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p> <input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr( $post->menu_order ); ?>" />
<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) : ?> <?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) : ?>
<p><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p> <p><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
<?php endif; <?php endif;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta3-39246'; $wp_version = '4.7-beta3-39247';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.