[wp-trac] [WordPress Trac] #60981: 6.5 adds the "is-layout-constrained" class to the wrong place for classic themes

WordPress Trac noreply at wordpress.org
Wed May 8 06:55:19 UTC 2024


#60981: 6.5 adds the "is-layout-constrained" class to the wrong place for classic
themes
-------------------------------------------------+-------------------------
 Reporter:  evanltd                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.5.3
Component:  Editor                               |     Version:  trunk
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  gutenberg-merge has-patch has-unit-  |     Focuses:  css
  tests fixed-major dev-reviewed                 |
-------------------------------------------------+-------------------------

Comment (by rickiwylder):

 What's the opinion on hybrid themes? We're using a hybrid setup on all
 sites which leverages the power of building with blocks but uses custom
 width settings and a classic theme setup in other aspects. Which means
 we're using theme.json without the layout setting. A common use case is
 using a group with a custom width setting inside another group. Now we
 have to deal with

 {{{
 body .is-layout-constrained >
 :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
     margin-left: auto !important;
     margin-right: auto !important;
 }
 }}}

 on these nested groups everywhere. Can we opt out of this in any way?
 Disabling layout styles isn't really an option as evanltd mentioned
 because it seems that we lose to much functionality. But forcing margins,
 especially with !important is not nice. Maybe what I'm looking for is a
 more granular approach of disable/enable styles or a setting on blocks to
 disable "constrained" (or set default layout type to default or custom)?

 This piece of CSS is impossible to get around (even if we could add CSS
 with !important to maybe overwrite the !importants we can't remove the
 margins, which is needed) so our current solution is to use both PHP
 (render_block()) and JS (editor) to force the `alignfull` class on all
 group blocks. But it feels cumbersome and should not be needed (?).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60981#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list