Skip to content

Commit

Permalink
Update to use a11y script module package in Core. (#65539)
Browse files Browse the repository at this point in the history
Update the interactivity-router package to use the @wordpress/a11y module for its aria-live regions.

This was behind a Gutenberg-only flag. Since the a11y module is landing in Core in 6.7, the flag can be removed to always use the a11y module.

See WordPress/wordpress-develop#7304.

Source: WordPress/gutenberg@7d883a4
  • Loading branch information
sirreal committed Sep 26, 2024
1 parent 7930aff commit 857fabf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build-module/assets.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('a11y/index.min.js' => array('dependencies' => array(), 'version' => '25c9ec16abe91b62e906', 'type' => 'module'), 'block-library/file/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '0600eabcab185ceb0430', 'type' => 'module'), 'block-library/image/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'e90ba1f1006920e85ee5', 'type' => 'module'), 'block-library/navigation/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '7b370e821516feba4955', 'type' => 'module'), 'block-library/query/view.min.js' => array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => '1100711c4bda188467ac', 'type' => 'module'), 'block-library/search/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '69851b7ac418d6ef7967', 'type' => 'module'), 'interactivity/index.min.js' => array('dependencies' => array(), 'version' => '2ba6ae592b7eef9952bb', 'type' => 'module'), 'interactivity/debug.min.js' => array('dependencies' => array(), 'version' => '1df6f2c1b2c7dc0e4dad', 'type' => 'module'), 'interactivity-router/index.min.js' => array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/a11y', 'import' => 'dynamic')), 'version' => '67c16aba5bbfcdd72f9a', 'type' => 'module'));
<?php return array('a11y/index.min.js' => array('dependencies' => array(), 'version' => '25c9ec16abe91b62e906', 'type' => 'module'), 'block-library/file/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '0600eabcab185ceb0430', 'type' => 'module'), 'block-library/image/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'e90ba1f1006920e85ee5', 'type' => 'module'), 'block-library/navigation/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '7b370e821516feba4955', 'type' => 'module'), 'block-library/query/view.min.js' => array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => '1100711c4bda188467ac', 'type' => 'module'), 'block-library/search/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '69851b7ac418d6ef7967', 'type' => 'module'), 'interactivity/index.min.js' => array('dependencies' => array(), 'version' => '2ba6ae592b7eef9952bb', 'type' => 'module'), 'interactivity/debug.min.js' => array('dependencies' => array(), 'version' => '1df6f2c1b2c7dc0e4dad', 'type' => 'module'), 'interactivity-router/index.min.js' => array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/a11y', 'import' => 'dynamic')), 'version' => '61e34d2019d119e32785', 'type' => 'module'));
21 changes: 12 additions & 9 deletions build-module/interactivity-router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ const {
url: window.location.href,
navigation: {
hasStarted: false,
hasFinished: false,
message: ''
hasFinished: false
}
},
actions: {
Expand Down Expand Up @@ -455,22 +454,26 @@ function a11ySpeak(messageKey) {
} catch {}
} else {
// Fallback to localized strings from Interactivity API state.
// @todo This block is for Core < 6.7.0. Remove when support is dropped.

// @ts-expect-error
if (state.navigation.texts?.loading) {
// @ts-expect-error
navigationTexts.loading = state.navigation.texts.loading;
}
// @ts-expect-error
if (state.navigation.texts?.loaded) {
// @ts-expect-error
navigationTexts.loaded = state.navigation.texts.loaded;
}
}
}
const message = navigationTexts[messageKey];
if (true) {
Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 105)).then(({
speak
}) => speak(message),
// Ignore failures to load the a11y module.
() => {});
} else {}
Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 105)).then(({
speak
}) => speak(message),
// Ignore failures to load the a11y module.
() => {});
}

// Add click and prefetch to all links.
Expand Down
2 changes: 1 addition & 1 deletion build-module/interactivity-router/index.min.js

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

2 changes: 1 addition & 1 deletion build-module/interactivity-router/index.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

### BEGIN AUTO-GENERATED DEFINES
define( 'GUTENBERG_VERSION', '19.3.0' );
define( 'GUTENBERG_GIT_COMMIT', '5df96133f050d8a56525bf68c55a10de8d61089d' );
define( 'GUTENBERG_GIT_COMMIT', '7d883a45cb865bfabf686787cd08dd21626b8835' );
### END AUTO-GENERATED DEFINES
defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '6.5' );

Expand Down

0 comments on commit 857fabf

Please sign in to comment.