Repository navigation
Conversation
The CTA Button / Buttons blocks declare popup-maker-block-library-style as their front-end "style" in block.json. Assets::register_scripts() registers that handle with a hard dependency on wp-block-editor, which in turn depends on wp-components and wp-preferences (and wp-theme). So every front-end page that renders a CTA button also loads the full block editor UI stylesheets (~30 KiB) as render-blocking CSS, none of which is used. Keep the wp-block-editor dependency in wp-admin, where the block editor loads those styles anyway, and register the block style without editor dependencies on the front end.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Set the dependency by context classes/Controllers/Assets.php |
Admin registration uses wp-block-editor as a dependency. Front-end registration uses no dependencies. |
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Bug fix
Suggested reviewers: danieliser
Merge Risk: 
Minimal · up to 2ac95
-
No actionable merge-blocking risk is established for this narrowly scoped stylesheet dependency change. Merge after normal checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Description
popup-maker-block-library-styleis the front-endstylehandle of the CTA Button and CTA Buttons blocks (packages/block-library/src/lib/cta-button/block.json,cta-buttons/block.json). InAssets::register_scripts()it is registered with a hard dependency onwp-block-editor:On the front end,
wp-block-editorpulls inwp-components,wp-preferencesandwp-theme. So every page that renders a CTA button (for example inside a popup that is loaded site-wide) also loads the block editor UI stylesheets as render-blocking CSS:wp-block-editorcss/dist/block-editor/style.min.csswp-componentscss/dist/components/style.min.csswp-preferencescss/dist/preferences/style.min.csswp-themecss/dist/theme/design-tokens.min.css(WordPress 7.1.4.) Lighthouse reports these as render-blocking and unused. Because the files live in
/wp-includes/, site owners tend to blame WordPress core rather than Popup Maker, which is probably why this hasn't been reported.The front-end block styles (
style.scssof both blocks) don't reference any editor classes, so they don't need these stylesheets.This change keeps the
wp-block-editordependency in wp-admin, so load order in the editor stays exactly as it is, and drops it on the front end:Related Issue: none found (searched the WordPress.org support forum and GitHub). Related: #1198 (missing
block-library-style.css), which concerns the same handle.Types of changes
Bug fix (non-breaking): front-end performance. No visual change.
How this was tested
Local test site: WordPress 7.1.4, PHP 8.3, Popup Maker 1.25.0 release build (
popup-maker_1.25.0.zip) with this patch applied (it applies cleanly to both 1.25.0 anddevelop). One page with a CTA Buttons/CTA Button block, one page without. Tested with a minimal classic theme and with Twenty Twenty-Five, each with WordPress' default on-demand block assets and with all block assets loaded (should_load_separate_core_block_assets/should_load_block_assets_on_demandreturning false).Stylesheets in the page HTML (
wp-block-editor,wp-components,wp-preferences,wp-theme):popup-maker-block-library-styleitself still loads wherever it did before.WP_ADMINdefined, the handle is still registered with[ 'wp-block-editor' ], so the editor's dependency chain is unchanged..phpcs.xml.dist; PHPCS 3.13.5, WPCS 3.4.1, CodeAtlantic 1.1.0, PHPCompatibilityWP 2.1.8, as pinned incomposer.lock) reports no violations forclasses/Controllers/Assets.php.debug.log.Screenshots
N/A: no visual change (verified pixel-identical, see above).
This has been tested in the following browsers
The change is server-side (which stylesheets WordPress enqueues), so the output is the same for every browser.
Merge Checklist
Summary by CodeRabbit