-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to use a11y script module package in Core. #65539
Conversation
4277fc8
to
fb4eba7
Compare
fb4eba7
to
4aa1449
Compare
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
4aa1449
to
9487bb1
Compare
@@ -403,30 +397,28 @@ function a11ySpeak( messageKey: keyof typeof navigationTexts ) { | |||
} 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 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just confirming, does this state come from the server in WP 6.6 and 6.5? Was it removed in WP core for WP 6.7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WordPress/wordpress-develop#7304 is expected to remove it in 6.7 and switch to the script module data passing. It was in the Interactivity API store state before that change, so in WordPress 6.6 it was in the Interactivity API store state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent. Thank you for confirmation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may not have answered that fully. Yes, it's server provided state in WordPress 6.6.
I'm testing using the "Testing Instructions" from PR description (using Core https://github.com/WordPress/wordpress-develop/pull/7304/files + copied packages from this PR). I see an odd issue: the output_6de84c.mp4It might be something silly or even unrelated but let's confirm it first 🙂 |
Thanks for the thorough testing!
This is expected behavior, the speak package adds a trailing gutenberg/packages/a11y/src/shared/filter-message.js Lines 20 to 26 in 3b99bb6
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me 👍 Thank you for working on this Jon!
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.
I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: 20ae57d |
See WordPress/wordpress-develop#7304.
What?
Update the interactivity-router package to always use the
@wordpress/a11y
module for its aria-live regions.This was behind a Gutenberg-only flag, but since landing in Core in 6.7 (with compatibility in Gutenberg for previous versions) the flag can be removed to always use the a11y module.
Why?
It's preferable to use the shared package that implements this functionality instead of a one-off implementation. Now that a11y is available as a script module, it should be used.
How?
Remove the
IS_GUTENBERG_PLUGIN
conditionals.Testing Instructions
This PR is difficult to test on its own because it requires the package to be updated as a Core dependency for proper testing. It does not affect Gutenberg behavior, only the package's behavior in Core. There are other ways of doing it but this works:
npm ci
in the Core checkout to install packages.npm run build:packages
in Gutenberg).@wordpress/interactivity-router
package in Core'snode_modules
(node_modules/@wordpress/interactivity-router
) with the package directory in Gutenberg (remove the directory and copy the directory from Gutenbergpackages/interactivity-router
).npm run dev
.Then test out that the interactivity router a11y functionality is working. A good way to test is the query block with "force page reload" option disabled. Specifically, the aria-live regions of the page should be updated (with localized text if in non-English locale) announcing "Page loaded."