mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-18 16:45:31 +01:00
5e07bfdfd1
Built from https://develop.svn.wordpress.org/trunk@31594 git-svn-id: http://core.svn.wordpress.org/trunk@31575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
47 lines
832 B
JavaScript
47 lines
832 B
JavaScript
window.wp = window.wp || {};
|
|
|
|
( function ( wp, $ ) {
|
|
'use strict';
|
|
|
|
var $container;
|
|
|
|
/**
|
|
* Update the ARIA live notification area text node.
|
|
*
|
|
* @since 4.2.0
|
|
*
|
|
* @param {String} message
|
|
*/
|
|
function speak( message ) {
|
|
if ( $container ) {
|
|
$container.text( message );
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Initialize wp.a11y and define ARIA live notification area.
|
|
*
|
|
* @since 4.2.0
|
|
*/
|
|
$( document ).ready( function() {
|
|
$container = $( '#wp-a11y-speak' );
|
|
|
|
if ( ! $container.length ) {
|
|
$container = $( '<div>', {
|
|
id: 'wp-a11y-speak',
|
|
role: 'status',
|
|
'aria-live': 'polite',
|
|
'aria-relevant': 'all',
|
|
'aria-atomic': 'true',
|
|
'class': 'screen-reader-text'
|
|
} );
|
|
|
|
$( document.body ).append( $container );
|
|
}
|
|
} );
|
|
|
|
wp.a11y = wp.a11y || {};
|
|
wp.a11y.speak = speak;
|
|
|
|
} )( window.wp, window.jQuery );
|