Customize: Remove redundant `aria-label` attributes.

Adds an `$options` array argument to `WP_Screen::render_screen_options()` to allow the `div#screen-options-wrap` element to be omitted when `wrap` value is `false`.

Props afercia, westonruter.
Fixes #33182.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-09-13 06:16:26 +00:00
parent f7a00464d5
commit bd801ae5db
4 changed files with 19 additions and 8 deletions

View File

@ -145,7 +145,7 @@ do_action( 'customize_controls_print_scripts' );
<div id="widgets-right"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat --> <div id="widgets-right"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat -->
<div class="wp-full-overlay-sidebar-content" tabindex="-1"> <div class="wp-full-overlay-sidebar-content" tabindex="-1">
<div id="customize-info" class="accordion-section customize-info"> <div id="customize-info" class="accordion-section customize-info">
<div class="accordion-section-title" aria-label="<?php esc_attr_e( 'Customizer Options' ); ?>"> <div class="accordion-section-title">
<span class="preview-notice"><?php <span class="preview-notice"><?php
echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name' ) . '</strong>' ); echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name' ) . '</strong>' );
?></span> ?></span>

View File

@ -1099,16 +1099,24 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* *
* @param array $options {
* @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true.
* }
* @global array $wp_meta_boxes * @global array $wp_meta_boxes
*/ */
public function render_screen_options() { public function render_screen_options( $options = array() ) {
global $wp_meta_boxes; global $wp_meta_boxes;
$options = wp_parse_args( $options, array(
'wrap' => true,
) );
$columns = get_column_headers( $this ); $columns = get_column_headers( $this );
$hidden = get_hidden_columns( $this ); $hidden = get_hidden_columns( $this );
?> ?>
<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>"> <?php if ( $options['wrap'] ) : ?>
<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>">
<?php endif; ?>
<form id="adv-settings" method="post"> <form id="adv-settings" method="post">
<?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?> <?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?>
<h5><?php _e( 'Show on screen' ); ?></h5> <h5><?php _e( 'Show on screen' ); ?></h5>
@ -1171,8 +1179,9 @@ final class WP_Screen {
?> ?>
<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
</form> </form>
</div> <?php if ( $options['wrap'] ) : ?>
<?php </div>
<?php endif;
} }
/** /**

View File

@ -416,7 +416,7 @@ class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel {
// Display screen options. // Display screen options.
$screen = WP_Screen::get( 'nav-menus.php' ); $screen = WP_Screen::get( 'nav-menus.php' );
$screen->render_screen_options(); $screen->render_screen_options( array( 'wrap' => false ) );
} }
/** /**
@ -475,7 +475,9 @@ class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel {
<# if ( data.description ) { #> <# if ( data.description ) { #>
<div class="description customize-panel-description">{{{ data.description }}}</div> <div class="description customize-panel-description">{{{ data.description }}}</div>
<# } #> <# } #>
<?php $this->render_screen_options(); ?> <div id="screen-options-wrap">
<?php $this->render_screen_options(); ?>
</div>
</li> </li>
<?php <?php
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34092'; $wp_version = '4.4-alpha-34093';
/** /**
* 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.