[Resolved] Gutenberg editor is left-aligned and reduced width since WordPress 5.9 update

Home Forums Support [Resolved] Gutenberg editor is left-aligned and reduced width since WordPress 5.9 update

Home Forums Support Gutenberg editor is left-aligned and reduced width since WordPress 5.9 update

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2093721
    Wes

    In the WordPress 5.9 update released today, the Gutenberg editor is now left-aligned and showing at a reduced width (full-width blocks do not stretch). It seems to be caused by this code inserted via #generate-block-editor-styles-inline-css.

    body .wp-block,
    html body.gutenberg-editor-page .editor-post-title__block,
    html body.gutenberg-editor-page .editor-default-block-appender,
    html body.gutenberg-editor-page .editor-block-list__block {
    	max-width: calc(1200px - 140px - 140px);
    }

    If I disable that rule, the editor shows as expected.

    Before Fix
    Before

    After Fix
    After

    Note this is only evident on displays wider than 1500px or so. GeneratePress + Premium are both fully updated.

    edit: Corrected images, which were previously swapped.

    #2093743
    Ying
    Staff
    Customer Support

    Hi Wes,

    Are these blocks are WP blocks and are set to align full?

    Let me know 🙂

    #2093745
    Wes

    I’m very sorry but I just noticed my images were backwards. I must have copied them in the wrong order. I’ve fixed that now.

    Yes, the blocks are set to align full. Here’s a better image showing that.

    GeneratePress Image

    As you can see, it’s being limited by that max-width style I quoted above.

    #2093746
    Ying
    Staff
    Customer Support

    Do you have sidebar activated on this page?

    #2093748
    Wes

    Nope, sidebars are disabled site-wide.

    Unmentioned previously, but I have this same problem on another GeneratePress site as of WP 5.9. I’m holding off on updating any more sites until I can resolve the issue.

    Please let me know if you need a live example.

    #2093750
    Ying
    Staff
    Customer Support

    Hum… any chance you can provide admin access to the site so I can take a look at the backend?

    Please use private info field for login details. Thanks!

    #2093760
    Wes

    I’ve created an admin user for you on an in-development site. See attached for details.

    Note that this site uses top-level group blocks of full width. Please let me know if you have any questions.

    #2093763
    Ying
    Staff
    Customer Support

    Hi Wes,

    We would recommend set the Content container to full width if you are using any align full blocks on the page.

    Can you give it a try:
    https://www.screencast.com/t/fqqePq7vIKtN

    #2093766
    Wes

    Thank you, that does appear to fix the problem. I see that’s a per-page setting. Is it possible to apply this site-wide, so I don’t need to apply it to every page (on every site…)?

    #2093768
    Ying
    Staff
    Customer Support

    Yes, you can use a layout element to achieve this:
    https://docs.generatepress.com/article/layout-element-overview/

    But we’ll still try to fix this issue for non-full-width page editor as well.

    Thanks for reporting this to us!

    #2093773
    Wes

    Thanks for your help Ying. I’ll evaluate the Layout element as a fix, but would look forward to a hotfix from your team as well.

    I’ll mark this thread as resolved for now, but if you use threads for tracking bugs do feel free to revert that. Thanks.

    #2093776
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Here’s a temporary fix until we release 3.1.2:

    add_action( 'enqueue_block_editor_assets', function() {
        wp_add_inline_style( 'generate-block-editor-styles', '.wp-block[data-align="full"] {max-width: none;}' );
    }, 20 );

    We’ll be releasing 3.1.2 this week after some more time goes by to find any other issues.

    Thanks!

    #2103195
    Math

    Hi Tom,

    Just want to bring to your attention while this resolves the alignment issue, the following code you provided to fix Block Editor Width causes the full-screen layout to revert back to left-aligned.

    add_action( 'enqueue_block_editor_assets', function() {
    	global $generate_elements;
    
    	foreach ( $generate_elements as $element ) {
    		if ( 'layout' === $element['type'] ) {
    			$content_width = get_post_meta( $element['id'], '_generate_content_width', true );
    
    			if ( $content_width ) {
    				$admin_css = 'body .wp-block{max-width: ' . absint( $content_width ) . 'px !important;}';
    				wp_add_inline_style( 'generate-block-editor-styles', $admin_css );
    			}
    		}
    	}
    }, 100 );

    Not a big deal right now, but thought you should know.

    Thank you.

    #2103454
    Tom
    Lead Developer
    Lead Developer

    Thanks for the heads up! That makes sense as that CSS is using !important. You may be able to remove that without re-introducing the bug.

    Once we release 3.1.3 with the fix you can remove that function and it should all go back to normal.

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.