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 - Interactivity API runtime for core blocks #49868

Closed
21 of 22 tasks
luisherranz opened this issue Apr 17, 2023 · 20 comments
Closed
21 of 22 tasks

Tracking Issue - Interactivity API runtime for core blocks #49868

luisherranz opened this issue Apr 17, 2023 · 20 comments
Assignees
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Block library /packages/block-library [Type] Experimental Experimental feature or API. [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@luisherranz
Copy link
Member

luisherranz commented Apr 17, 2023

The Interactivity API aims to provide a standard way to develop the frontend of Gutenberg blocks, in a way that they can communicate and be combined with each other easily.

Until now, most Gutenberg APIs have focused on the Block Editor, leaving an intentional gap in the frontend. The Interactivity API aims to cover that gap.

Imagine providing user experiences like instant search, add to cart, or comments form without a page reload, in a way that is immediately familiar and compatible with the block ecosystem, without complex scaffolding or external tools, and without sacrificing PHP server rendering and the plugin ecosystem. That's what the Interactivity API is for.

The goal of these tasks is to provide a basic runtime to start experimenting with interactivity in some of the core blocks.

We will start shaping the version of the runtime on a branch of the block interactivity experiments repo, and once it's ready we'll move it to this repository:

Navigation block

@luisherranz luisherranz added [Type] Experimental Experimental feature or API. [Feature] Interactivity API API to add frontend interactivity to blocks. labels Apr 17, 2023
@gziolo gziolo added [Package] Block library /packages/block-library [Status] In Progress Tracking issues with work in progress labels Apr 18, 2023
@DAreRodz
Copy link
Contributor

I've opened a PR that removes full hydration and client-side navigation. It is ready to be reviewed.

@DAreRodz
Copy link
Contributor

I've done the same for removing components.

@luisherranz
Copy link
Member Author

I've asked the Preact team about this PR to know if they plan to merge it soon or not. If they don't, I'll add a new issue to incorporate that data-wp-effect fix/feature in our codebase. We need that to avoid having to resort to tick in cases like this.

@luisherranz
Copy link
Member Author

luisherranz commented Apr 18, 2023

Once we finish, I think the next step would be to introduce priorities because that's going to affect the code of the Directive component.

@luisherranz
Copy link
Member Author

This is ready for review:

@DAreRodz
Copy link
Contributor

This one is merged:

And this other one ready for review

@priethor priethor added the [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. label Apr 19, 2023
@luisherranz
Copy link
Member Author

I have updated the refactoring-for-gutenberg branch with the latest changes from the main one.

@luisherranz
Copy link
Member Author

I've opened a PR for these items: WordPress/block-interactivity-experiments#223

  • Switch _wrapper to runningDirectives
  • Keep directives in the DOM (related conversation)
  • Pass the whole store to evaluate (instead of just state)

I'll work on Solve bug of props passing to the next element now.

@luisherranz
Copy link
Member Author

I'll work on Solve bug of props passing to the next element now.

I don't think there's anything to fix at this moment for this one.

It's a bit difficult to explain, so I made a video, but I'll mark the task as completed:

https://www.loom.com/share/c797fa787d5b4b2da1d19e832fc7205b

@luisherranz
Copy link
Member Author

We've merged everything that was needed before moving this to Gutenberg.

We'll try to move it to Gutenberg now in a new PR.

@DAreRodz
Copy link
Contributor

This is the PR that adds the Interactivity API to Gutenberg. It is ready to review.

@gziolo gziolo mentioned this issue Apr 24, 2023
69 tasks
@luisherranz
Copy link
Member Author

I've added these additional items to the list:

  • Implement directive priorities
  • Add wp-portal directive
  • Add wp-init directive

@artemiomorales
Copy link
Contributor

I added the following to the list:

@gziolo
Copy link
Member

gziolo commented May 9, 2023

@luisherranz
Copy link
Member Author

I've added three issues to the Tracking Issue discovered by @jeryj that contain accessibility discrepancies between this implementation and the previous one (thanks, Jerry!).

He also reported a problem with the register_block_script_handle function that we should look into.

@gziolo
Copy link
Member

gziolo commented May 19, 2023

He also reported a problem with the register_block_script_handle function that we should look into.

I can't reproduce it with the latest version in trunk. I'm wondering whether there is anything different with the testing env. I'll also double-check if all files get correctly included in the plugin's zip file.

@luisherranz
Copy link
Member Author

It looks like that one was just a problem with node_modules so there's nothing to fix 🙂

Also, @DAreRodz has been working on the priorities:

@luisherranz
Copy link
Member Author

Closing this as finished, we'll keep working on the next steps on: #50866

@luisherranz
Copy link
Member Author

Reopened to add an additional task to merge both vendors and runtime together in a single file, and use the wp-interactivity handle because that handle needs to be maintained if this is merged with Core.

@luisherranz
Copy link
Member Author

Closed as we don't need to that anymore.

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jul 24, 2023
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. [Package] Block library /packages/block-library [Type] Experimental Experimental feature or API. [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

5 participants