]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/wp-a11y.js
WordPress 4.7-scripts
[autoinstalls/wordpress.git] / wp-includes / js / wp-a11y.js
index 14f419a06bc2b2ceee0c17a96b6701b1b98fb5c5..2507cbc2f4edca376a9ca102382aa3099ce7f057 100644 (file)
@@ -4,8 +4,7 @@ window.wp = window.wp || {};
        'use strict';
 
        var $containerPolite,
-               $containerAssertive,
-               role;
+               $containerAssertive;
 
        /**
         * Update the ARIA live notification area text node.
@@ -21,6 +20,9 @@ window.wp = window.wp || {};
                // Clear previous messages to allow repeated strings being read out.
                clear();
 
+               // Ensure only text is sent to screen readers.
+               message = $( '<p>' ).html( message ).text();
+
                if ( $containerAssertive && 'assertive' === ariaLive ) {
                        $containerAssertive.text( message );
                } else if ( $containerPolite ) {
@@ -39,11 +41,9 @@ window.wp = window.wp || {};
         */
        function addContainer( ariaLive ) {
                ariaLive = ariaLive || 'polite';
-               role = 'assertive' === ariaLive ? 'alert' : 'status';
 
                var $container = $( '<div>', {
                        'id': 'wp-a11y-speak-' + ariaLive,
-                       'role': role,
                        'aria-live': ariaLive,
                        'aria-relevant': 'additions text',
                        'aria-atomic': 'true',