Ticket #31368: 31368.2.patch
| File 31368.2.patch, 7.5 KB (added by , 11 years ago) |
|---|
-
src/wp-admin/admin-header.php
189 189 } 190 190 ?> 191 191 192 <div id="wp-speak" role="status" aria-live="polite" aria-relevant="all" aria-atomic="true" class="screen-reader-text"></div> 193 192 194 <div id="wpwrap"> 193 195 <a tabindex="1" href="#wpbody-content" class="screen-reader-shortcut"><?php _e('Skip to main content'); ?></a> 194 196 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?> -
src/wp-admin/admin.php
93 93 $time_format = get_option('time_format'); 94 94 95 95 wp_enqueue_script( 'common' ); 96 wp_enqueue_script( 'a11y' ); 96 97 97 98 // $pagenow is set in vars.php 98 99 // $wp_importers is sometimes set in wp-admin/includes/import.php -
src/wp-admin/customize.php
118 118 <body class="<?php echo esc_attr( $body_class ); ?>"> 119 119 <div class="wp-full-overlay expanded"> 120 120 <form id="customize-controls" class="wrap wp-full-overlay-sidebar"> 121 <div id=" screen-reader-messages" role="status" aria-live="polite" aria-relevant="all" aria-atomic="true" class="screen-reader-text"></div>121 <div id="wp-speak" role="status" aria-live="polite" aria-relevant="all" aria-atomic="true" class="screen-reader-text"></div> 122 122 123 123 <div id="customize-header-actions" class="wp-full-overlay-header"> 124 124 <?php -
src/wp-admin/js/customize-widgets.js
685 685 686 686 if ( isMoveUp ) { 687 687 self.moveUp(); 688 $( '#screen-reader-messages' ).text( l10n.widgetMovedUp );688 wp.speak( l10n.widgetMovedUp ); 689 689 } else { 690 690 self.moveDown(); 691 $( '#screen-reader-messages' ).text( l10n.widgetMovedDown );691 wp.speak( l10n.widgetMovedDown ); 692 692 } 693 693 694 694 $( this ).focus(); // re-focus after the container was moved … … 1987 1987 return settingId; 1988 1988 } 1989 1989 1990 wp.a11y.debug = true; 1991 1990 1992 })( window.wp, jQuery ); -
src/wp-admin/js/updates.js
107 107 108 108 $message.addClass( 'updating-message' ); 109 109 $message.text( wp.updates.l10n.updating ); 110 wp.speak( wp.updates.l10n.updatingMsg ); 110 111 111 112 if ( wp.updates.updateLock ) { 112 113 wp.updates.updateQueue.push( { … … 153 154 154 155 $message.removeClass( 'updating-message' ).addClass( 'updated-message' ); 155 156 $message.text( wp.updates.l10n.updated ); 157 wp.speak( wp.updates.l10n.updatedMsg ); 156 158 157 159 wp.updates.decrementCount( 'plugin' ); 158 160 }; … … 173 175 } 174 176 $message.removeClass( 'updating-message' ); 175 177 $message.text( wp.updates.l10n.updateFailed ); 178 wp.speak( wp.updates.l10n.updateFailed ); 176 179 }; 177 180 178 181 /** … … 198 201 199 202 $message.addClass( 'updating-message' ); 200 203 $message.text( wp.updates.l10n.installing ); 204 wp.speak( wp.updates.l10n.installingMsg ); 201 205 202 206 if ( wp.updates.updateLock ) { 203 207 wp.updates.updateQueue.push( { … … 234 238 235 239 $message.removeClass( 'updating-message' ).addClass( 'updated-message button-disabled' ); 236 240 $message.text( wp.updates.l10n.installed ); 241 wp.speak( wp.updates.l10n.installedMsg ); 237 242 }; 238 243 239 244 /** … … 316 321 } 317 322 wp.updates.installPlugin( $button.data( 'slug' ) ); 318 323 } ); 324 325 wp.a11y.debug = true; 319 326 } ); 320 327 321 328 $( window ).on( 'message', function( e ) { -
src/wp-includes/js/wp-a11y.js
1 window.wp = window.wp || {}; 2 3 ( function ( wp, $ ) { 4 'use strict'; 5 6 var a11y; 7 8 a11y = wp.a11y = wp.a11y || {}; 9 10 /** 11 * Flag to enable debug mode. 12 * Set this to true in your script after wp.a11y is executed to have messages 13 * printed out in your browser's console. 14 * 15 * @since 4.2.0 16 * 17 * @var bool 18 */ 19 a11y.debug = false; 20 21 /** 22 * wp.a11y.log 23 * 24 * A debugging utility. Works only when the debug flag is on and the browser 25 * supports it. 26 * 27 * @since 4.2.0 28 */ 29 a11y.log = function() { 30 if ( window.console && a11y.debug ) { 31 window.console.log.apply( window.console, arguments ); 32 } 33 }; 34 35 /** 36 * wp.a11y.speak 37 * 38 * Update the ARIA live notification area text node. 39 * 40 * @since 4.2.0 41 * 42 * @param {string} message 43 */ 44 a11y.speak = function( message ) { 45 46 if ( 0 === a11y.liveContainer.length ) { 47 // No need to make this translatable, it's just for debugging. 48 a11y.log( 'WP speak can\'t speak: no live notification area present' ); 49 return; 50 } 51 52 // Log messages to the console when debugging. 53 a11y.log( 'WP speak: ' + message ); 54 55 // Make messages available to screen readers. 56 a11y.liveContainer.text( message ); 57 58 }; 59 60 /** 61 * Give developers an easy, handy, shortcut to send messages to screen readers. 62 * 63 * Usage: wp.speak( 'your text string here' ); 64 * 65 * @since 4.2.0 66 */ 67 wp.speak = a11y.speak; 68 69 /** 70 * Initialize wp.a11y and define ARIA live notification area. 71 * 72 * @since 4.2.0 73 */ 74 a11y.init = function() { 75 a11y.liveContainer = $( '#wp-speak' ); 76 }; 77 78 $( document ).ready( a11y.init ); 79 80 } ( window.wp, jQuery ) ); -
src/wp-includes/script-loader.php
82 82 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete.") 83 83 ) ); 84 84 85 $scripts->add( 'a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 ); 86 85 87 $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 ); 86 88 87 89 $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 ); … … 379 381 380 382 $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), 'r7', 1 ); 381 383 382 $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );384 $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore', 'a11y' ), false, 1 ); 383 385 $scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 ); 384 386 $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'customize-base' ), false, 1 ); 385 387 $scripts->add( 'customize-models', "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 ); … … 511 513 'installing' => __( 'Installing...' ), 512 514 'installed' => __( 'Installed!' ), 513 515 'installFailed' => __( 'Installation failed' ), 516 'updatingMsg' => __( 'Updating... please wait.' ), 517 'installingMsg' => __( 'Installing... please wait.' ), 518 'updatedMsg' => __( 'Update completed successfully.' ), 519 'installedMsg' => __( 'Installation completed successfully.' ), 514 520 ) 515 521 ) ); 516 522