-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add filter to turn off Interactivity API for a block #52579
Conversation
* @since 6.3.0 | ||
* |
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.
This may not be right.
Flaky tests detected in 9858855. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5545553033
|
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.
The code looks good to me and it works fine. I just added a small suggestion below 👍
…ocks Co-authored-by: Luis Herranz <luisherranz@gmail.com>
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.
Tested again and it's working perfectly. Feel free to merge 🙂
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.
I've tested as well, and everything seems correct 🙂
…dd/defer-script-loading-strategy * 'trunk' of https://github.com/WordPress/gutenberg: (24 commits) Add filter to turn off Interactivity API for a block (#52579) Search: Remove unnecessary useEffect (#52604) Navigation: Simplify the useSelect for useNavigationMenus (#51977) Item: Unify focus style and add default font styles (#52495) Update Changelog for 16.2.1 Bump plugin version to 16.2.1 Avoid passing undefined `selectedBlockClientId` in `BlockActionsMenu` (#52595) Cover Block: Fix block deprecation when fixed background is enabled (#51612) Nav block: link text color inheritance fixes and tests (#51710) Stabilize defaultBlock, directInsert API's and getDirectInsertBlock selector (#52083) Fix console warning by improving error handling in Nav block classic menu conversion (#52591) Fix: Remove link action of Link UI for draft pages created from Nav block does not correctly remove link. (#52415) Lodash: Remove remaining `_.get()` from block editor and deprecate (#52561) Fix importing classic menus (#52573) ResizableFrame: Make keyboard accessible (#52443) Site Editor: Fix navigation menu sidebar actions order and label (#52592) correct a typo: sapce -> space (#52578) Avoid errors in Dimension visualizers when switching between iframed and non-iframed editors (#52588) Patterns: Add client side pagination to patterns list (#52538) Site Editor: Make sidebar back button go *back* instead of *up* if possible (#52456) ...
What?
Add a
gutenberg_should_block_use_interactivity_api
filter which allows the experimental Interactivity API to be disabled for a given block.Why?
This is a follow-up to #52553 for reasons explained in #50906 (comment). Currently the only way to prevent the Interactivity API from being used for the File block or Navigation block is to hack the
GUTENBERG_IS_PLUGIN
constant to befalse
. Since the experimental Interactivity API is not behind an experiment feature flag, this filter is needed in order to be able to access and hack on the old implementations.How?
The
gutenberg_should_block_use_interactivity_api
filter is added in a function of the same name. This is used in places where theGUTENBERG_IS_PLUGIN
constant was used to determine whether to use the Interactivity API.Testing Instructions
Add a mu-plugin that that includes this code:
When absent, a post with the File block and Navigation block contain in the footer:
When present, those scripts do not appear in the footer and instead these scripts appear in the
head
: