-
Notifications
You must be signed in to change notification settings - Fork 849
Forms: fix block styles not loading in CIAB environment. #46643
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
base: trunk
Are you sure you want to change the base?
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
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.
Pull request overview
This pull request aims to fix an issue where form block styles were not loading in the CIAB (Create in App Builder) environment by consolidating the asset loading approach.
Changes:
- Consolidated script and style loading into a single method using
Assets::register_script()withcss_pathparameter - Removed the separate
load_editor_styles()method and its associatedenqueue_block_assetshook - Moved the
enqueue_block_editor_assetshook registration from the plugin file into theregister_block()method
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| projects/plugins/jetpack/extensions/blocks/contact-form/contact-form.php | Removed asset loading hooks, keeping only block registration |
| projects/plugins/jetpack/changelog/fix-forms-styles-ciab | Added changelog entry for the fix |
| projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php | Consolidated asset loading logic and moved hook registration into register_block() |
| projects/packages/forms/changelog/fix-forms-styles-ciab | Added changelog entry for the fix |
| wp_enqueue_style( 'jp-forms-blocks' ); | ||
|
|
Copilot
AI
Jan 16, 2026
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 line should be removed. The wp_enqueue_style() call is attempting to enqueue a style that hasn't been registered yet. The Assets::register_script() call below (with 'enqueue' => true and 'css_path' => '../../../dist/blocks/editor.css') will automatically register and enqueue both the script and its associated stylesheet, making this manual enqueue call unnecessary and incorrect.
| wp_enqueue_style( 'jp-forms-blocks' ); |
Code Coverage SummaryCoverage changed in 2 files.
|
| * Load editor styles for the block. | ||
| * These are loaded via enqueue_block_assets to ensure proper loading in the editor iframe context. | ||
| */ | ||
| public static function load_editor_styles() { |
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.
Since this is a public function I think we should add a deprecation notice before removing it.
Since it could cause fatal errors or any plugin that also calls it.
d31c8f0 to
eafa117
Compare
Fixes FORMS-533
Proposed changes:
Before
After
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: