Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental: Navigation block with the Interactivity API (#50041)
* Add interactivity runtime Co-authored-by: David Arenas <david.arenas@automattic.com> * Add it to the image block This is still pretty basic, just to check that it works. Co-authored-by: David Arenas <david.arenas@automattic.com> * Add a separate webpack config Co-authored-by: David Arenas <david.arenas@automattic.com> * Make sure the runtime is imported only once Co-authored-by: David Arenas <david.arenas@automattic.com> * Use sideEffects instead of init Co-authored-by: David Arenas <david.arenas@automattic.com> * Move script registration to a general file Co-authored-by: David Arenas <david.arenas@automattic.com> * Add `defer` to the interactivity scripts Co-authored-by: David Arenas <david.arenas@automattic.com> * Revert changes of the image block Co-authored-by: David Arenas <david.arenas@automattic.com> * Fix init import name Co-authored-by: David Arenas <david.arenas@automattic.com> * Add experimental setting to use Interactivity API * Add basic `interactivity.js` file * Enqueue old script/interactivity API conditionally * Add `tick()` function until Preact bug is solved * Add code to handle the overlayMenu * Add Interactivity API to submenu block * Add Interactivity API to page list block * Change code to be more declarative and simple * Use `__DIR__` instead of `__FILE__` * Change loading script conditional * Fix issues momentarily * Fix some issues with focus * Add tabindex to modal * Revert to current navigation block * Add directives through a filter * Dont add latest modifications to navigation block * Ensure focus doesn't get inside menu after closing * Add conditionals and change function names * Use `gutenberg_is_experiment_enabled` function * Add interactivity runtime Co-authored-by: David Arenas <david.arenas@automattic.com> * Add it to the image block This is still pretty basic, just to check that it works. Co-authored-by: David Arenas <david.arenas@automattic.com> * Add a separate webpack config Co-authored-by: David Arenas <david.arenas@automattic.com> * Make sure the runtime is imported only once Co-authored-by: David Arenas <david.arenas@automattic.com> * Use sideEffects instead of init Co-authored-by: David Arenas <david.arenas@automattic.com> * Move script registration to a general file Co-authored-by: David Arenas <david.arenas@automattic.com> * Add `defer` to the interactivity scripts Co-authored-by: David Arenas <david.arenas@automattic.com> * Revert changes of the image block Co-authored-by: David Arenas <david.arenas@automattic.com> * Fix init import name Co-authored-by: David Arenas <david.arenas@automattic.com> * Move and refactor the interactive scritps registration * Fix code style violations * Use `wp-interactivity-` prefix for script handles * Improve the matcher for side effects in `package.json` * Enqueue interactivity scripts through hook * Revert `client-assets.php` file * Adapt to latest changes in base branch * Add custom useSignalEffect * Move role attribute to selectors * Call `init` after `store` has been initialized * Change focusable elements * Add namespaces to context * Move PHP file to interactivity-api folder * Add comments with the markup to the PHP filter * Remove micromodal attributes * Add interactivity runtime Co-authored-by: David Arenas <david.arenas@automattic.com> * Add it to the image block This is still pretty basic, just to check that it works. Co-authored-by: David Arenas <david.arenas@automattic.com> * Add a separate webpack config Co-authored-by: David Arenas <david.arenas@automattic.com> * Make sure the runtime is imported only once Co-authored-by: David Arenas <david.arenas@automattic.com> * Use sideEffects instead of init Co-authored-by: David Arenas <david.arenas@automattic.com> * Move script registration to a general file Co-authored-by: David Arenas <david.arenas@automattic.com> * Add `defer` to the interactivity scripts Co-authored-by: David Arenas <david.arenas@automattic.com> * Revert changes of the image block Co-authored-by: David Arenas <david.arenas@automattic.com> * Fix init import name Co-authored-by: David Arenas <david.arenas@automattic.com> * Move and refactor the interactive scritps registration * Fix code style violations * Use `wp-interactivity-` prefix for script handles * Improve the matcher for side effects in `package.json` * Add custom useSignalEffect * Call `init` after `store` has been initialized * Update lib/experimental/interactivity-api/script-loader.php Co-authored-by: Weston Ruter <westonruter@google.com> * Plugin: Ensure that translations are set correctly when overriding scripts This replicates the same logic in WordPress core: https://github.com/WordPress/wordpress-develop/blob/a5f3087f6b5d9c52dbe67ed247165dc32427c57d/src/wp-includes/script-loader.php#L306-L308 * Remove unnecessary comment in webpack config Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl> * Clean up code to fix PHP coding standards issues * Remove extra space * Add tests to the navigation block interactivity * Modify `saveSiteEditorEntities` function to wait * Fix page-list tests * Remove e2e tests that are already included in trunk * Fix the navigation menu when the overlay is not present * Ensure that all scripts using Intereactivity API have defer attribute * Remove unused param in the callback used by hook --------- Co-authored-by: Luis Herranz <luisherranz@gmail.com> Co-authored-by: David Arenas <david.arenas@automattic.com> Co-authored-by: Grzegorz Ziolkowski <grzegorz@gziolo.pl> Co-authored-by: Weston Ruter <westonruter@google.com>
- Loading branch information
a992f2a
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.
Flaky tests detected in a992f2a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4938036405
📝 Reported issues:
/test/e2e/specs/editor/blocks/image.spec.js
/test/e2e/specs/editor/plugins/custom-post-types.spec.js
specs/editor/various/autosave.test.js