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 git-svn-id: https://develop.svn.wordpress.org/trunk@46167 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b7df2ea08c
commit
8029e23ffe
@ -303,7 +303,6 @@ module.exports = function(grunt) {
|
|||||||
[ WORKING_DIR + 'wp-includes/js/quicktags.js' ]: [ './src/js/_enqueues/lib/quicktags.js' ],
|
[ WORKING_DIR + 'wp-includes/js/quicktags.js' ]: [ './src/js/_enqueues/lib/quicktags.js' ],
|
||||||
[ WORKING_DIR + 'wp-includes/js/shortcode.js' ]: [ './src/js/_enqueues/wp/shortcode.js' ],
|
[ WORKING_DIR + 'wp-includes/js/shortcode.js' ]: [ './src/js/_enqueues/wp/shortcode.js' ],
|
||||||
[ WORKING_DIR + 'wp-includes/js/utils.js' ]: [ './src/js/_enqueues/lib/cookies.js' ],
|
[ WORKING_DIR + 'wp-includes/js/utils.js' ]: [ './src/js/_enqueues/lib/cookies.js' ],
|
||||||
[ WORKING_DIR + 'wp-includes/js/wp-a11y.js' ]: [ './src/js/_enqueues/wp/a11y.js' ],
|
|
||||||
[ WORKING_DIR + 'wp-includes/js/wp-ajax-response.js' ]: [ './src/js/_enqueues/lib/ajax-response.js' ],
|
[ WORKING_DIR + 'wp-includes/js/wp-ajax-response.js' ]: [ './src/js/_enqueues/lib/ajax-response.js' ],
|
||||||
[ WORKING_DIR + 'wp-includes/js/wp-api.js' ]: [ './src/js/_enqueues/wp/api.js' ],
|
[ WORKING_DIR + 'wp-includes/js/wp-api.js' ]: [ './src/js/_enqueues/wp/api.js' ],
|
||||||
[ WORKING_DIR + 'wp-includes/js/wp-auth-check.js' ]: [ './src/js/_enqueues/lib/auth-check.js' ],
|
[ WORKING_DIR + 'wp-includes/js/wp-auth-check.js' ]: [ './src/js/_enqueues/lib/auth-check.js' ],
|
||||||
@ -846,7 +845,6 @@ module.exports = function(grunt) {
|
|||||||
'src/wp-includes/js/quicktags.js': 'src/js/_enqueues/lib/quicktags.js',
|
'src/wp-includes/js/quicktags.js': 'src/js/_enqueues/lib/quicktags.js',
|
||||||
'src/wp-includes/js/shortcode.js': 'src/js/_enqueues/wp/shortcode.js',
|
'src/wp-includes/js/shortcode.js': 'src/js/_enqueues/wp/shortcode.js',
|
||||||
'src/wp-includes/js/utils.js': 'src/js/_enqueues/lib/cookies.js',
|
'src/wp-includes/js/utils.js': 'src/js/_enqueues/lib/cookies.js',
|
||||||
'src/wp-includes/js/wp-a11y.js': 'src/js/_enqueues/wp/a11y.js',
|
|
||||||
'src/wp-includes/js/wp-ajax-response.js': 'src/js/_enqueues/lib/ajax-response.js',
|
'src/wp-includes/js/wp-ajax-response.js': 'src/js/_enqueues/lib/ajax-response.js',
|
||||||
'src/wp-includes/js/wp-api.js': 'src/js/_enqueues/wp/api.js',
|
'src/wp-includes/js/wp-api.js': 'src/js/_enqueues/wp/api.js',
|
||||||
'src/wp-includes/js/wp-auth-check.js': 'src/js/_enqueues/lib/auth-check.js',
|
'src/wp-includes/js/wp-auth-check.js': 'src/js/_enqueues/lib/auth-check.js',
|
||||||
|
@ -786,6 +786,9 @@ $_old_files = array(
|
|||||||
// 5.1
|
// 5.1
|
||||||
'wp-includes/random_compat/random_bytes_openssl.php',
|
'wp-includes/random_compat/random_bytes_openssl.php',
|
||||||
'wp-includes/js/tinymce/wp-tinymce.js.gz',
|
'wp-includes/js/tinymce/wp-tinymce.js.gz',
|
||||||
|
// 5.3
|
||||||
|
'wp-includes/js/wp-a11y.js', // Moved to: wp-includes/js/dist/a11y.js
|
||||||
|
'wp-includes/js/wp-a11y.min.js', // Moved to: wp-includes/js/dist/a11y.min.js
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -734,12 +734,12 @@ JS;
|
|||||||
global $wp_scripts;
|
global $wp_scripts;
|
||||||
|
|
||||||
wp_default_scripts( $wp_scripts );
|
wp_default_scripts( $wp_scripts );
|
||||||
|
wp_default_packages( $wp_scripts );
|
||||||
|
|
||||||
$wp_scripts->base_url = '';
|
$wp_scripts->base_url = '';
|
||||||
$wp_scripts->do_concat = true;
|
$wp_scripts->do_concat = true;
|
||||||
|
|
||||||
$expected_tail = "<![endif]-->\n";
|
$expected_tail = "<script type='text/javascript' src='/customize-dependency.js'></script>\n";
|
||||||
$expected_tail .= "<script type='text/javascript' src='/customize-dependency.js'></script>\n";
|
|
||||||
$expected_tail .= "<script type='text/javascript'>\n";
|
$expected_tail .= "<script type='text/javascript'>\n";
|
||||||
$expected_tail .= "tryCustomizeDependency()\n";
|
$expected_tail .= "tryCustomizeDependency()\n";
|
||||||
$expected_tail .= "</script>\n";
|
$expected_tail .= "</script>\n";
|
||||||
@ -748,10 +748,12 @@ JS;
|
|||||||
wp_enqueue_script( $handle, '/customize-dependency.js', array( 'customize-controls' ), null );
|
wp_enqueue_script( $handle, '/customize-dependency.js', array( 'customize-controls' ), null );
|
||||||
wp_add_inline_script( $handle, 'tryCustomizeDependency()' );
|
wp_add_inline_script( $handle, 'tryCustomizeDependency()' );
|
||||||
|
|
||||||
|
// Open a buffer to get the output of `wp_print_scripts`.
|
||||||
|
ob_start();
|
||||||
wp_print_scripts();
|
wp_print_scripts();
|
||||||
$print_scripts = get_echo( '_print_scripts' );
|
$print_scripts = ob_get_clean();
|
||||||
|
|
||||||
$tail = substr( $print_scripts, strrpos( $print_scripts, '<![endif]-->' ) );
|
$tail = substr( $print_scripts, strrpos( $print_scripts, "<script type='text/javascript' src='/customize-dependency.js'>" ) );
|
||||||
$this->assertEquals( $expected_tail, $tail );
|
$this->assertEquals( $expected_tail, $tail );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<script src="../../build/wp-includes/js/wp-util.js"></script>
|
<script src="../../build/wp-includes/js/wp-util.js"></script>
|
||||||
<script src="../../build/wp-includes/js/wp-a11y.js"></script>
|
<script src="../../build/wp-includes/js/dist/a11y.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window._wpMediaModelsL10n = {"settings":{"ajaxurl":"\/wp-admin\/admin-ajax.php","post":{"id":0}}};
|
window._wpMediaModelsL10n = {"settings":{"ajaxurl":"\/wp-admin\/admin-ajax.php","post":{"id":0}}};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user