Accessibility: Improve the Theme Details modal accessibility.

- sets the modal content to `role="document"` to make screen readers switch back to browse mode
- standardizes the Themes screen and Customizer modals interaction
- Themes screen modal: sets initial focus on the modal overlay instead of the primary button, avoiding to "skip" content for keyboard and screen reader users

Fixes #42055.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2017-10-01 13:48:46 +00:00
parent e23b4e9269
commit 1f4dab28fe
5 changed files with 10 additions and 10 deletions

View File

@ -632,7 +632,7 @@ function customize_themes_print_templates() {
?>
<script type="text/html" id="tmpl-customize-themes-details-view">
<div class="theme-backdrop"></div>
<div class="theme-wrap wp-clearfix">
<div class="theme-wrap wp-clearfix" role="document">
<div class="theme-header">
<button type="button" class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
<button type="button" class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>

View File

@ -683,7 +683,7 @@ themes.view.Details = wp.Backbone.View.extend({
// Set initial focus on the primary action control.
_.delay( function() {
$( '.theme-wrap a.button-primary:visible' ).focus();
$( '.theme-overlay' ).focus();
}, 100 );
// Constrain tabbing within the modal.
@ -1603,10 +1603,10 @@ themes.view.Installer = themes.view.Appearance.extend({
this.listenTo( this.collection, 'query:fail', function() {
$( 'body' ).removeClass( 'loading-content' );
$( '.theme-browser' ).find( 'div.error' ).remove();
$( '.theme-browser' ).find( 'div.themes' ).before( '<div class="error"><p>' + l10n.error + '</p><p><button class="button try-again">' + l10n.tryAgain + '</button></p></div>' );
$( '.theme-browser .error .try-again' ).on( 'click', function( e ) {
e.preventDefault();
$( 'input.wp-filter-search' ).trigger( 'input' );
$( '.theme-browser' ).find( 'div.themes' ).before( '<div class="error"><p>' + l10n.error + '</p><p><button class="button try-again">' + l10n.tryAgain + '</button></p></div>' );
$( '.theme-browser .error .try-again' ).on( 'click', function( e ) {
e.preventDefault();
$( 'input.wp-filter-search' ).trigger( 'input' );
} );
});

File diff suppressed because one or more lines are too long

View File

@ -301,7 +301,7 @@ foreach ( $themes as $theme ) :
<?php endforeach; ?>
</div>
</div>
<div class="theme-overlay"></div>
<div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
<p class="no-themes"><?php _e( 'No themes found. Try a different search query.' ); ?></p>
@ -431,7 +431,7 @@ $can_install = current_user_can( 'install_themes' );
<script id="tmpl-theme-single" type="text/template">
<div class="theme-backdrop"></div>
<div class="theme-wrap wp-clearfix">
<div class="theme-wrap wp-clearfix" role="document">
<div class="theme-header">
<button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
<button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41657';
$wp_version = '4.9-alpha-41658';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.