Skip to content

Commit

Permalink
Editor: Add inert attribute polyfill.
Browse files Browse the repository at this point in the history
The new Gutenberg packages are using the inert attribute
to disable some parts of the HTML tree in an accessible way.

Props ntsekouras.
Fixes #57492.


git-svn-id: https://develop.svn.wordpress.org/trunk@55084 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
youknowriad committed Jan 18, 2023
1 parent ec6b2f2 commit 15b5159
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"regenerator-runtime": "0.13.9",
"twemoji": "14.0.2",
"underscore": "1.13.6",
"whatwg-fetch": "3.6.2"
"whatwg-fetch": "3.6.2",
"wicg-inert": "3.1.2"
},
"scripts": {
"build": "grunt build",
Expand Down
4 changes: 3 additions & 1 deletion src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ function wp_default_packages_vendor( $scripts ) {
'wp-polyfill-dom-rect',
'wp-polyfill-element-closest',
'wp-polyfill-object-fit',
'wp-polyfill' => array( 'regenerator-runtime' ),
'wp-polyfill-inert',
'wp-polyfill' => array( 'wp-polyfill-inert', 'regenerator-runtime' ),
);

$vendor_scripts_versions = array(
Expand All @@ -115,6 +116,7 @@ function wp_default_packages_vendor( $scripts ) {
'wp-polyfill-dom-rect' => '4.4.0',
'wp-polyfill-element-closest' => '2.0.2',
'wp-polyfill-object-fit' => '2.3.5',
'wp-polyfill-inert' => '3.1.2',
'wp-polyfill' => '3.15.0',
);

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/dependencies/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public function test_wp_add_inline_script_before_after_concat_with_core_dependen

$ver = get_bloginfo( 'version' );
$suffix = wp_scripts_get_suffix();
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate,regenerator-runtime,wp-polyfill,wp-dom-ready,wp-hooks&amp;ver={$ver}'></script>\n";
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-dom-ready,wp-hooks&amp;ver={$ver}'></script>\n";
$expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/i18n.min.js' id='wp-i18n-js'></script>\n";
Expand Down
2 changes: 2 additions & 0 deletions tools/webpack/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
'wp-polyfill-dom-rect.js': 'polyfill-library/polyfills/__dist/DOMRect/raw.js',
'wp-polyfill-formdata.js': 'formdata-polyfill/FormData.js',
'wp-polyfill-object-fit.js': 'objectFitPolyfill/src/objectFitPolyfill.js',
'wp-polyfill-inert.js': 'wicg-inert/dist/inert.js',
'moment.js': 'moment/moment.js',
'react.js': 'react/umd/react.development.js',
'react-dom.js': 'react-dom/umd/react-dom.development.js',
Expand All @@ -83,6 +84,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
'wp-polyfill-formdata.min.js': 'formdata-polyfill/formdata.min.js',
'wp-polyfill-url.min.js': 'core-js-url-browser/url.min.js',
'wp-polyfill-object-fit.min.js': 'objectFitPolyfill/dist/objectFitPolyfill.min.js',
'wp-polyfill-inert.min.js': 'wicg-inert/dist/inert.min.js',
'moment.min.js': 'moment/min/moment.min.js',
'react.min.js': 'react/umd/react.production.min.js',
'react-dom.min.js': 'react-dom/umd/react-dom.production.min.js',
Expand Down

0 comments on commit 15b5159

Please sign in to comment.