WordPress.org

Make WordPress Core

Ticket #45066: 45066.4.diff

File 45066.4.diff, 6.5 KB (added by herregroen, 12 months ago)
  • src/wp-admin/includes/update-core.php

     
    779779        'wp-includes/js/mediaelement/renderers/soundcloud.min.js',
    780780        'wp-includes/js/mediaelement/renderers/twitch.js',
    781781        'wp-includes/js/mediaelement/renderers/twitch.min.js',
     782        // 5.0.0
     783        'wp-includes/js/wp-a11y.js', // Moved to: wp-includes/js/dist/a11y.js
     784        'wp-includes/js/wp-a11y.min.js', // Moved to: wp-includes/js/dist/a11y.min.js
    782785);
    783786
    784787/**
  • src/wp-includes/js/wp-a11y.js

     
    1 /** @namespace wp */
    2 window.wp = window.wp || {};
    3 
    4 ( function ( wp, $ ) {
    5         'use strict';
    6 
    7         var $containerPolite,
    8                 $containerAssertive,
    9                 previousMessage = '';
    10 
    11         /**
    12          * Update the ARIA live notification area text node.
    13          *
    14          * @since 4.2.0
    15          * @since 4.3.0 Introduced the 'ariaLive' argument.
    16          *
    17          * @param {String} message    The message to be announced by Assistive Technologies.
    18          * @param {String} [ariaLive] The politeness level for aria-live. Possible values:
    19          *                            polite or assertive. Default polite.
    20          * @returns {void}
    21          */
    22         function speak( message, ariaLive ) {
    23                 // Clear previous messages to allow repeated strings being read out.
    24                 clear();
    25 
    26                 // Ensure only text is sent to screen readers.
    27                 message = $( '<p>' ).html( message ).text();
    28 
    29                 /*
    30                  * Safari 10+VoiceOver don't announce repeated, identical strings. We use
    31                  * a `no-break space` to force them to think identical strings are different.
    32                  * See ticket #36853.
    33                  */
    34                 if ( previousMessage === message ) {
    35                         message = message + '\u00A0';
    36                 }
    37 
    38                 previousMessage = message;
    39 
    40                 if ( $containerAssertive && 'assertive' === ariaLive ) {
    41                         $containerAssertive.text( message );
    42                 } else if ( $containerPolite ) {
    43                         $containerPolite.text( message );
    44                 }
    45         }
    46 
    47         /**
    48          * Build the live regions markup.
    49          *
    50          * @since 4.3.0
    51          *
    52          * @param {String} ariaLive Optional. Value for the 'aria-live' attribute, default 'polite'.
    53          *
    54          * @return {Object} $container The ARIA live region jQuery object.
    55          */
    56         function addContainer( ariaLive ) {
    57                 ariaLive = ariaLive || 'polite';
    58 
    59                 var $container = $( '<div>', {
    60                         'id': 'wp-a11y-speak-' + ariaLive,
    61                         'aria-live': ariaLive,
    62                         'aria-relevant': 'additions text',
    63                         'aria-atomic': 'true',
    64                         'class': 'screen-reader-text wp-a11y-speak-region'
    65                 });
    66 
    67                 $( document.body ).append( $container );
    68                 return $container;
    69         }
    70 
    71         /**
    72          * Clear the live regions.
    73          *
    74          * @since 4.3.0
    75          */
    76         function clear() {
    77                 $( '.wp-a11y-speak-region' ).text( '' );
    78         }
    79 
    80         /**
    81          * Initialize wp.a11y and define ARIA live notification area.
    82          *
    83          * @since 4.2.0
    84          * @since 4.3.0 Added the assertive live region.
    85          */
    86         $( document ).ready( function() {
    87                 $containerPolite = $( '#wp-a11y-speak-polite' );
    88                 $containerAssertive = $( '#wp-a11y-speak-assertive' );
    89 
    90                 if ( ! $containerPolite.length ) {
    91                         $containerPolite = addContainer( 'polite' );
    92                 }
    93 
    94                 if ( ! $containerAssertive.length ) {
    95                         $containerAssertive = addContainer( 'assertive' );
    96                 }
    97         });
    98 
    99         /** @namespace wp.a11y */
    100         wp.a11y = wp.a11y || {};
    101         wp.a11y.speak = speak;
    102 
    103 }( window.wp, window.jQuery ));
  • src/wp-includes/script-loader.php

     
    699699                'expandMenu'   => __( 'Expand Main menu' ),
    700700        ) );
    701701
    702         $scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );
    703 
    704702        $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
    705703
    706704        $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
  • tests/phpunit/tests/dependencies/scripts.php

     
    668668                global $wp_scripts;
    669669
    670670                wp_default_scripts( $wp_scripts );
     671                wp_default_packages( $wp_scripts );
    671672
    672673                $wp_scripts->base_url  = '';
    673674                $wp_scripts->do_concat = true;
    674675
    675676                $ver = get_bloginfo( 'version' );
    676                 $expected  = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5B%5D=jquery-core,jquery-migrate,wp-a11y&amp;ver={$ver}'></script>\n";
     677
     678                $expected  = "\n<script type='text/javascript'>\n";
     679                $expected .= "/* <![CDATA[ */\n";
     680                $expected .= "( 'fetch' in window ) || document.write( '<script src=\"/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js\"></scr' + 'ipt>' );/* ]]> */\n";
     681                $expected .= "</script>\n";
     682                $expected .= "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5B%5D=jquery-core,jquery-migrate,wp-polyfill,wp-dom-ready,wp-a11y&amp;ver={$ver}'></script>\n";
    677683                $expected .= "<script type='text/javascript'>\nconsole.log(\"before\");\n</script>\n";
    678684                $expected .= "<script type='text/javascript' src='http://example.com'></script>\n";
    679685                $expected .= "<script type='text/javascript' src='http://example2.com'></script>\n";
     
    697703                global $wp_scripts;
    698704
    699705                wp_default_scripts( $wp_scripts );
     706                wp_default_packages( $wp_scripts );
    700707
    701708                $wp_scripts->base_url  = '';
    702709                $wp_scripts->do_concat = true;
  • tests/qunit/index.html

     
    2424                        };
    2525                </script>
    2626                <script src="../../src/wp-includes/js/wp-util.js"></script>
    27                 <script src="../../src/wp-includes/js/wp-a11y.js"></script>
     27                <script src="../../src/wp-includes/js/dist/a11y.js"></script>
    2828                <script>
    2929                        window._wpMediaModelsL10n = {"settings":{"ajaxurl":"\/wp-admin\/admin-ajax.php","post":{"id":0}}};
    3030                </script>