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

Interactivity Router: Update for latest package changes #7447

Conversation

sirreal
Copy link
Member

@sirreal sirreal commented Sep 27, 2024

Reapply changes from [59097] / #7304.
Restore and deprecated the renamed method print_router_loading_and_screen_reader_markup.

Description and testing instructions are the same as on the original PR:

Accounts for changes to the @wordpress/interactivity-router module in:

Static localized strings are passed via script module data passing instead of in Interactivity API store state.
Redundant HTML used for aria-live regions is removed. This functionality is not handled by the @wordpress/a11y script module added in #7405.

Testing

Testing this requires package updates from WordPress/gutenberg#65539. It anticipates the package being released and updated in Core.

(Copied from WordPress/gutenberg#65539)

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:

  • Get a checkout of Core from Interactivity Router: Update for latest GB changes. #7304. This is the build that will be running.
  • Run npm ci in the Core checkout to install packages.
  • Build the package from this PR (npm run build:packages in Gutenberg).
  • Replace the @wordpress/interactivity-router package in Core's node_modules (node_modules/@wordpress/interactivity-router) with the package directory in Gutenberg (remove the directory and copy the directory from Gutenberg packages/interactivity-router).
  • In Core, run the npm build script you use, in my case 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."

Trac ticket: https://core.trac.wordpress.org/ticket/60647


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…hould be deprecated instead."

This reverts commit bbec266.
Keep the original method (as a no-op) to avoid possible fatal errors.
@sirreal sirreal marked this pull request as ready for review September 27, 2024 08:14
Copy link

github-actions bot commented Sep 27, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jonsurrell, czapla.

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

@sirreal
Copy link
Member Author

sirreal commented Sep 27, 2024

Here's the diff comparing this with the original commit from ad1fabe / [59097]:

diff --git before/src/wp-includes/interactivity-api/class-wp-interactivity-api.php after/src/wp-includes/interactivity-api/class-wp-interactivity-api.php
index e4dec8e262..8ffd612b13 100644
--- before/src/wp-includes/interactivity-api/class-wp-interactivity-api.php
+++ after/src/wp-includes/interactivity-api/class-wp-interactivity-api.php
@@ -993,6 +993,16 @@ final class WP_Interactivity_API {
 CSS;
 	}
 
+	/**
+	 * Deprecated.
+	 *
+	 * @since 6.5.0
+	 * @deprecated 6.7.0 Use {@see WP_Interactivity_API::print_router_markup} instead.
+	 */
+	public function print_router_loading_and_screen_reader_markup() {
+		_deprecated_function( __METHOD__, '6.7.0', 'WP_Interactivity_API::print_router_markup' );
+	}
+
 	/**
 	 * Outputs markup for the @wordpress/interactivity-router script module.
 	 *

@sirreal
Copy link
Member Author

sirreal commented Sep 27, 2024

@michalczaplinski This is ready to try again 🙂

Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

…uter_loading_and_screen_reader_markup` method
Comment on lines +1004 to +1007

// Call the new method.
$this->print_router_markup();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we need to call the "new" method here. I've just added it in e09839e

@michalczaplinski michalczaplinski self-requested a review September 30, 2024 16:03
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.

👍

@michalczaplinski
Copy link
Contributor

@sirreal sirreal deleted the update/interactivity-router-latest-package branch October 1, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants