Make WordPress Core

Changeset 46167


Ignore:
Timestamp:
09/18/2019 05:40:35 PM (5 years ago)
Author:
whyisjake
Message:

Accessibility: Replace wp-a11y.js with @wordpress/a11y package

We've extracted wp-includes/wp-a11y.js to a reusable package wordpress/a11y which is published on NPM. Let's make sure this package is also used in WordPress core. Once all the JavaScript is built using webpack, we can also import this package wherever it is used and configure webpack to load is an external.

Props omarreiss, herregroen, desrosj, ocean90, afercia, sstoqnov

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r45769 r46167  
    304304                    [ WORKING_DIR + 'wp-includes/js/shortcode.js' ]: [ './src/js/_enqueues/wp/shortcode.js' ],
    305305                    [ WORKING_DIR + 'wp-includes/js/utils.js' ]: [ './src/js/_enqueues/lib/cookies.js' ],
    306                     [ WORKING_DIR + 'wp-includes/js/wp-a11y.js' ]: [ './src/js/_enqueues/wp/a11y.js' ],
    307306                    [ WORKING_DIR + 'wp-includes/js/wp-ajax-response.js' ]: [ './src/js/_enqueues/lib/ajax-response.js' ],
    308307                    [ WORKING_DIR + 'wp-includes/js/wp-api.js' ]: [ './src/js/_enqueues/wp/api.js' ],
     
    847846                    'src/wp-includes/js/shortcode.js': 'src/js/_enqueues/wp/shortcode.js',
    848847                    'src/wp-includes/js/utils.js': 'src/js/_enqueues/lib/cookies.js',
    849                     'src/wp-includes/js/wp-a11y.js': 'src/js/_enqueues/wp/a11y.js',
    850848                    'src/wp-includes/js/wp-ajax-response.js': 'src/js/_enqueues/lib/ajax-response.js',
    851849                    'src/wp-includes/js/wp-api.js': 'src/js/_enqueues/wp/api.js',
  • trunk/src/wp-admin/includes/update-core.php

    r45932 r46167  
    787787    'wp-includes/random_compat/random_bytes_openssl.php',
    788788    'wp-includes/js/tinymce/wp-tinymce.js.gz',
     789    // 5.3
     790    'wp-includes/js/wp-a11y.js', // Moved to: wp-includes/js/dist/a11y.js
     791    'wp-includes/js/wp-a11y.min.js', // Moved to: wp-includes/js/dist/a11y.min.js
    789792);
    790793
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r46164 r46167  
    735735
    736736        wp_default_scripts( $wp_scripts );
     737        wp_default_packages( $wp_scripts );
    737738
    738739        $wp_scripts->base_url  = '';
    739740        $wp_scripts->do_concat = true;
    740741
    741         $expected_tail  = "<![endif]-->\n";
    742         $expected_tail .= "<script type='text/javascript' src='/customize-dependency.js'></script>\n";
     742        $expected_tail = "<script type='text/javascript' src='/customize-dependency.js'></script>\n";
    743743        $expected_tail .= "<script type='text/javascript'>\n";
    744744        $expected_tail .= "tryCustomizeDependency()\n";
     
    749749        wp_add_inline_script( $handle, 'tryCustomizeDependency()' );
    750750
     751        // Open a buffer to get the output of `wp_print_scripts`.
     752        ob_start();
    751753        wp_print_scripts();
    752         $print_scripts = get_echo( '_print_scripts' );
    753 
    754         $tail = substr( $print_scripts, strrpos( $print_scripts, '<![endif]-->' ) );
     754        $print_scripts = ob_get_clean();
     755
     756        $tail = substr( $print_scripts, strrpos( $print_scripts, "<script type='text/javascript' src='/customize-dependency.js'>" ) );
    755757        $this->assertEquals( $expected_tail, $tail );
    756758    }
  • trunk/tests/qunit/index.html

    r45979 r46167  
    2525        </script>
    2626        <script src="../../build/wp-includes/js/wp-util.js"></script>
    27         <script src="../../build/wp-includes/js/wp-a11y.js"></script>
     27        <script src="../../build/wp-includes/js/dist/a11y.js"></script>
    2828        <script>
    2929            window._wpMediaModelsL10n = {"settings":{"ajaxurl":"\/wp-admin\/admin-ajax.php","post":{"id":0}}};
Note: See TracChangeset for help on using the changeset viewer.