Skip to content
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

A11y: Move script module HTML printing to 6.7 compat #65620

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

sirreal
Copy link
Member

@sirreal sirreal commented Sep 24, 2024

What?

  • Ensure that the HTML printing for the @wordpress/a11y script module does not conflict with Core.
  • Move the @wordpress/a11y script module code to the 6.7 compat directory.

This PR is dependent on WordPress/wordpress-develop#7405

Why?

When WordPress/wordpress-develop#7405 lands, this could would run redundantly and create multiple DOM elements with the same ID.

How?

Conditionally set the filters based on the presence of the new method in Core.

Testing Instructions

Ensure the regions are created but are not duplicated when testing with Core ([59089] or later).

@sirreal sirreal added Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta [Type] Task Issues or PRs that have been broken down into an individual action to take [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] A11y /packages/a11y No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core labels Sep 24, 2024
@sirreal sirreal marked this pull request as ready for review September 25, 2024 18:24
Copy link

github-actions bot commented Sep 25, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
Co-authored-by: michalczaplinski <czapla@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@sirreal sirreal marked this pull request as draft September 25, 2024 18:24
This code is needed for compatibility with WordPress < 6.7.
The filter should only be registered if the Core filter will not run,
otherwise redundant elements are printed.

See:

WordPress/wordpress-develop#7405
@sirreal sirreal force-pushed the update/move-a11y-module-to-6.7-compat branch from 8de717e to e4b36b1 Compare September 25, 2024 19:20
@michalczaplinski michalczaplinski marked this pull request as ready for review September 25, 2024 20:24
Copy link
Contributor

@michalczaplinski michalczaplinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with:

Works like a charm in both cases 👍

@sirreal sirreal merged commit 57e4be7 into trunk Sep 26, 2024
65 checks passed
@sirreal sirreal deleted the update/move-a11y-module-to-6.7-compat branch September 26, 2024 09:39
@github-actions github-actions bot added this to the Gutenberg 19.4 milestone Sep 26, 2024
@github-actions github-actions bot removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Sep 26, 2024
gutenbergplugin pushed a commit that referenced this pull request Sep 26, 2024
- Ensure that the HTML printing for the @wordpress/a11y script module does not conflict with Core.
- Move the @wordpress/a11y script module code to the 6.7 compat directory.

The a11y script module HTML printing filters are set conditionally. If Core would set them, Gutenberg does not.
This ensures that duplicate HTML elements (with identical element IDs) are not added to the page.

This is necessary for compatibility with WordPress 6.7 that adds the @wordpress/a11y Script Module.

See https://core.trac.wordpress.org/changeset/59089.

---

Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
Co-authored-by: michalczaplinski <czapla@git.wordpress.org>
Copy link

I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: 783c65e

@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Package] A11y /packages/a11y [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants