fix: prevent content-gate editor.scss styles from getting chunked into the common.css file#4716
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses unintended Gutenberg component styling bleed caused by editor.scss being imported by multiple entrypoints and ending up in a shared/common stylesheet chunk. It isolates the block visibility panel styles into a dedicated stylesheet and tweaks the generic BaseControl margin rule to avoid impacting the publish-date time UI.
Changes:
- Switched
block-visibility.tsxto import a newblock-visibility.scssinstead ofeditor.scss, preventingeditor.scssfrom being pulled into a common chunk. - Extracted the block visibility panel SCSS from
editor.scssinto the newblock-visibility.scss. - Adjusted
.components-base-controlspacing ineditor.scssto exclude DateTime/time-wrapper controls.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/content-gate/editor/editor.scss |
Removes now-unneeded WP variables import, updates BaseControl margin behavior, and removes block-visibility panel styles (moved out). |
src/content-gate/editor/block-visibility.tsx |
Stops importing editor.scss and imports the new, dedicated block-visibility stylesheet. |
src/content-gate/editor/block-visibility.scss |
New isolated styles for the Access Control block visibility panel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks @adekbadek -- everything should be addressed! Can you take another peek and let me know if anything else looks amiss! |
adekbadek
left a comment
There was a problem hiding this comment.
All three items addressed in code: missing CSS enqueue, newspack-content-gate-panel scoping class on Metering + PostSettings, and $grid-unit-20 token. Verified via the before/after screenshots.
|
Thanks for the review, @adekbadek! 🙌 |
|
Hey @laurelfulford, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
## [6.42.1](v6.42.0...v6.42.1) (2026-06-02) ### Bug Fixes * prevent content-gate editor.scss styles from getting chunked into the common.css file ([#4716](#4716)) ([4d4c557](4d4c557))
|
🎉 This PR is included in version 6.42.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
## [6.42.1](Automattic/newspack-plugin@v6.42.0...v6.42.1) (2026-06-02) ### Bug Fixes * prevent content-gate editor.scss styles from getting chunked into the common.css file ([#4716](Automattic/newspack-plugin#4716)) ([f6e5a56](Automattic/newspack-plugin@f6e5a56))
All Submissions:
Changes proposed in this Pull Request:
This one was weird!
In #4646, a new file
block-visibility.tsxstarted importingcontent-gate/editor.scss. Newspack Plugin's Webpack hasminChunks: 2; since this was the second file editor.css was imported into, it started getting included in the common.css, which caused the.components-base-controlstyles in that CSS file to bleed into more post types.The
.components-base-controlstyle wasn't very specific, but this only started being an issue when the styles were imported into more editors.This PR does two things:
.components-base-controlstyles more specific (adding content gate-specific CSS classes) since this issue was still happening when you edited a Content Gate.Closes NPPM-2812
How to test the changes in this Pull Request:
npm run build; refresh the post editor and confirm the date picker looks okay.define( 'NEWSPACK_CONTENT_GATES', true );to your wp-config.php, and set up a content gate).Other information: