Editor HTML: Give #poststuff div a broader scope; remove unused #postbox-container-2#4697
Editor HTML: Give #poststuff div a broader scope; remove unused #postbox-container-2#4697youknowriad merged 7 commits intoWordPress:masterfrom gthayer:update/html-cleanup
Conversation
youknowriad
left a comment
There was a problem hiding this comment.
Thanks for working on this.
It could be a nice idea to rebase master because right now we can't really try this PR since the meta boxes are not showing up because of this #4773
Also, this breaks the design of the meta boxes because we're relying on #poststuff to style the meta boxes in /editor/components/meta-boxes/meta-boxes-area/style.scss. We should probably update these styles to rely on something else for specificity.
Might be good to test with some popular meta boxes plugin to see if there's no regressions compared to master.
|
Tested style updates with ACF and Yoast. I've corrected any of the style issues related to this change within Gutenberg, however WP core is also using I'm not sure whether I should be overwriting core's styles whole cloth, or if this PR is something which should be reviewed later when Gutenberg is merged with core. |
|
Thanks for the updates @gthayer This is way better. And yes, let's "copy" these styles to make them work with the new selectors and once we merge we'd have to remove the useless styles from Core. |
|
Added the styles for improved metabox labels. I did some more testing with ACF and other metabox plugins, and found a few more issues.
In an effort to reduce styling based on ID, I've switched Lastly, metabox inputs had a max-width of 300px. This was breaking the display of some plugins. I don't see where this was adding any value, so I removed it. |
| #post { | ||
| margin: 0; | ||
| } | ||
| #post { |
There was a problem hiding this comment.
Unrelated to this PR but I believe this one is not necessary anymore, this is probably a leftover for some old PR.
|
Moving the While I can increase the specificity and even rewrite the CSS rules for headings, @mtias only just discovered the h2 heading receiving the new styles. There could be a bunch of other stuff cascading into the editor. Do we actually need the poststuff class there, or is there a different way to apply it so that metaboxes can inherit those styles, but without them bleeding into the editor? |
|
@jasmussen Unfortunately, we need it there because it has to contain all the meta boxes (content and sidebar) since we can't use an id twice. And this So if it's easy enough to override these styles, I think we should do it. If it takes a lot of time, we can revert this change temporarily while fixing those. |
|
The problem is as soon as we start overwriting these styles with more specificty we are making it much harder for themes to supply their own styles. I really don't want to see |
|
Maybe we're fine with not valid HTML in this case? (instead of breaking meta boxes) |
|
Is there a way we can find out how many, even ball-park, plugins that are affected by the previous configuration compared to this? And how hard would it be for those plugins to update to function in that configuration? |
|
Would something like this work? This maintains the backwards compatibility for plugins, but "#poststuff" only wraps the metaboxs. I did a quick search on one of my sites, and found that |
|
@gthayer This doesn't take the "side" meta boxes into account. |
|
Seems like it would be valuable to try and find out in slightly more detail what, specifically, metaboxes do with the #poststuff class. For example if we were to limit this class to only below-the-post metaboxes, how would that affect side metaboxes? Would there only be CSS issues? I'm all for supporting metaboxes, but we have to try and find a balance between a clean and optimized codebase going forward, otherwise we are creating new technical debt. |
|
I think part of the problem is I've looked into a few flagship plugins I use, and the usage appears somewhat consistent. Advanced Custom Fields
BuddyPress
Gravity Forms
Jetpack
|
|
One more: WooCommerce
|


Description
Removed some duplicate IDs which are printed in the metabox area.
This is somewhat in reference to #2375
How Has This Been Tested?
npm testScreenshots (jpeg or gifs if applicable):
Types of changes
Gave
#poststuffa broader scope as it wraps the entire editor in classic.Removed
#postbox-container-2as it is not being used at all.Checklist:
I believe I am all set with these items, but I'd appreciate some outside help