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

Tracking Issue: Prepare the private version of the Interactivity API for WP 6.4 #54291

Closed
21 of 24 tasks
luisherranz opened this issue Sep 8, 2023 · 27 comments
Closed
21 of 24 tasks
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@luisherranz
Copy link
Member

luisherranz commented Sep 8, 2023

WP 6.4 will include Gutenberg up to the 16.7 version, which includes the new Image Lightbox, an enhanced pagination for the Query block and accessibility fixes for the Navigation block, all of them powered by the Interactivity API. Although the Interactivity API is still in the proposal phase, we can include a private version that only Core blocks can access in WP 6.4 to release these features/enhancements.

Please note that the Interactivity API is still likely to change before the final public version is released, but by keeping it private to Core blocks in WP 6.4, we can still modify it before it's public. Furthermore, if the proposal is finally rejected for some reason, we just have to replace the Interactivity API implementation of the Core blocks with whatever new approach is adopted instead.

The release of the 16.7 RC is scheduled for the 20th of September. Before that date, we need to complete the following tasks:

@luisherranz luisherranz added [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. [Feature] Interactivity API API to add frontend interactivity to blocks. labels Sep 8, 2023
@SantosGuillamot
Copy link
Contributor

I created this pull request to remove gutenberg_should_block_use_interactivity_api and the old implementation of the Navigation and File blocks. In the end, I decided to do everything simultaneously because of some related conditionals.

#54297

@luisherranz
Copy link
Member Author

Approved! Thanks, Mario 👍

@luisherranz
Copy link
Member Author

I've opened a PR to test the WP Core webpack configuration. It's not finished yet, but so far it seems to be working great:

@SantosGuillamot
Copy link
Contributor

I've opened a PR to add manual SSR to the Navigation block and the File block. As explained in the pull request, I believe that in the File block, it is complicated to replicate the JS logic, so we have to make a decision there.

@SantosGuillamot
Copy link
Contributor

I've been reviewing the Search block PR, and I think it should be ready to be merged, it needs review and approval. I also modified it so it works without the Interactivity API SSR.

@DAreRodz
Copy link
Contributor

I've opened a draft PR for disabling the enhanced pagination if third-party blocks exist in the Post Template.

@luisherranz
Copy link
Member Author

I've added a new task for the Query block:

  • Remove the usage of wp_store.

@SantosGuillamot
Copy link
Contributor

I've created a pull request to remove the usage of wp_store in the Query block:

@SantosGuillamot
Copy link
Contributor

The PR to move the Search block to the Interactivity API has been merged:

@luisherranz
Copy link
Member Author

luisherranz commented Sep 12, 2023

I've sucessfully finished modifying the Webpack files to make @wordpress/interactivity a private package:

The next step is to try to test it out in WP Core. I've also added a couple of related tasks to the opening post.

@luisherranz
Copy link
Member Author

I've ported the changes to WordPress Core and they are working great. This should be ready to merge once the sync between Gutenberg and WP Core happens (with the correct modifications to the PR).

@luisherranz
Copy link
Member Author

@artemiomorales, @michalczaplinski: @tellthemachines mentioned me that we need to review the usage of WP_Theme_JSON_Resolver_Gutenberg in the Image block before the 16.7 RC release (20th of Sept).

This is the exact message:

We're calling WP_Theme_JSON_Resolver_Gutenberg in the Image block PHP file, which isn't defined in core. We'll need to add some logic similar to this to check if the core class exists.

I've added to the list of tasks in the opening post. Please take care of it and mark it as ready afterward. Thanks 🙂

@luisherranz
Copy link
Member Author

I've opened an issue with some design enhancements mentioned by @jasmussen. There are some that we should do before the 16.7 RC release, and others that we can try if we have time:

@DAreRodz
Copy link
Contributor

The changes to allow only core blocks inside a Query Loop with enhanced pagination are done and merged.

I'll continue with the rest of the enhancements.

@DAreRodz
Copy link
Contributor

This addresses most of the design feedback from @jasmussen. 👇

It's ready for review.

@DAreRodz
Copy link
Contributor

I've created another PR that adds a timeout option to navigate(), with a default value of 10000 milliseconds (10 seconds).

@luisherranz
Copy link
Member Author

David opened another PR to improve the accessibility of the modal:

@luisherranz
Copy link
Member Author

luisherranz commented Sep 18, 2023

Open PR in Gutenberg to add this code to each interactive block to make sure that all the scripts have the wp-interactivity dependency

I think it's safe to do this in WordPress itself. I'll add it to this PR instead: (see below)

@michalczaplinski
Copy link
Contributor

We're calling WP_Theme_JSON_Resolver_Gutenberg in the Image block PHP file, which isn't defined in core. We'll need to add some logic similar to this to check if the core class exists.

This issue was fixed by merging #53851 which removes the reference to WP_Theme_JSON_Resolver_Gutenberg in the Image block. There is another reference to WP_Theme_JSON_Resolver_Gutenberg in

$theme_data = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data()->get_data();
which is temporarily added to Gutenberg for backward-compatibility and will be removed in GB 17.0.

@SantosGuillamot
Copy link
Contributor

I've created a PR to handle the remaining tasks related to the lightbox:

@tellthemachines
Copy link
Contributor

Open PR in Gutenberg to add this code to each interactive block to make sure that all the scripts have the wp-interactivity dependency

I think it's safe to do this in WordPress itself. I'll add it to this PR instead:

@luisherranz does this require changes to block PHP files? If so, it has to be done in Gutenberg. The block PHP gets generated in core from the block-library package so it can't be manually edited there.

@luisherranz
Copy link
Member Author

luisherranz commented Sep 19, 2023

@luisherranz does this require changes to block PHP files?

No, it doesn't. We can add it in Core in wp-includes/script-loader.php if that's ok.

EDIT: I tried, but I think it's simpler to add it here in Gutenberg:

@luisherranz
Copy link
Member Author

I added logic to start prefetching the next pages on the first click to the next and previous buttons:

@DAreRodz
Copy link
Contributor

I opened a PR that shows a subtle animation when the HTML is updated and changes the scroll behavior to smooth during navigation. Ready for review.

@ermincelikovic
Copy link

Hi folks, thanks for the good work!

I just wanted to understand better - Interactivity API is not going to be useable outside of WP Core in 6.4?
Does it mean it is planned for 6.5?

@SantosGuillamot
Copy link
Contributor

I just wanted to understand better - Interactivity API is not going to be useable outside of WP Core in 6.4?
Does it mean it is planned for 6.5?

Yes, in 6.4, only core blocks can use the Interactivity API. If you want to use the Interactivity API for your custom blocks, you need to install the Gutenberg plugin as well. We considered it safer this way because there are some parts that need more testing and the API is likely to change. So it might require developers who built custom blocks using the API to change the syntax.

On the other hand, if everything goes as expected, the idea is to make it public in WP Core in 6.5 as you say.

@luisherranz
Copy link
Member Author

Even though there's still some discussion about the fading animation of the Query block, I'm going to close this Tracking Issue as finished because WP 6.4 Beta 1 has already been released.

We will continue working in the new store() API, please follow the progress in this Tracking Issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
No open projects
Status: Done
Development

No branches or pull requests

6 participants