Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment-Options for all blocks (custom or core) do not show in 6.2 Beta 1 to 3 for our custom WP-Theme. #48360

Closed
FabianKielmann opened this issue Feb 23, 2023 · 1 comment

Comments

@FabianKielmann
Copy link

FabianKielmann commented Feb 23, 2023

Description

While developing a custom gutenberg block in our own custom wordpress-theme, we discovered that the alignment-options for all blocks disappear.

This has to be a combination of 6.2 Beta 1 to 3 and something with our custom theme, but I haven't found the issue yet. But since the bug disappears when switching back to WordPress version 6.1.1, I think this should still be a WordPress-Bug.

Although the alignment-options also disappear for all core-blocks, I still want to demonstrate how we registered our block where we expected the alignment-options to show up:

In out theme we add theme support for align-wide like this:

public function add_theme_supports() {
    add_theme_support( 'wp-block-styles' );
    add_theme_support( 'block-templates' );
    add_theme_support( 'editor-styles' );
    add_theme_support( 'align-wide' );
    add_theme_support( 'responsive-embeds' );
}

add_action(
    'after_setup_theme',
    array( $this, 'add_theme_supports' ),
);

We then made a custom plugin to register the custom block. This is the complete block.json:

{
	"$schema": "https://schemas.wp.org/trunk/block.json",
	"apiVersion": 2,
	"name": "custom-block",
	"version": "0.1.0",
	"title": "Mainblock",
	"category": "theme",
	"icon": "admin-links",
	"supports": {
		"html": true,
		"inserter": true,
		"multiple": true,
		"reusable": true,
		"align": true,
		"alignWide": true
	},
	"example": {},
	"description": "...",
	"textdomain": "our-custom-plugin",
	"editorScript": "file:./index-mainblock.js",
	"render": "file:./render-mainblock.php"
}

We have then also added the layout-property in our theme.json under "settings":

  "settings": {
    "layout": {
      "contentSize": "840px",
      "wideSize": "1100px"
    },

Below I will attach a screenshot of how the alignment-options look like on a core-block (image).

I'm not sure what in the custom theme could potentially cause this, but we didn't really do anything crazy. If you need more information on the custom theme we're using, please let me know. At least I cant say that we're not messing around with css that could hide these options or something similar.

Step-by-step reproduction instructions

The bug can't be reproduced with for example the twentytwentyone-theme, so I guess you have to have some sort of custom theme enabled to reproduce it.

If you have, these are the steps:

  • Go to a new blank page and open it in the Gutenberg editor
  • Add a core block
  • Click the alignment-icon in the toolbar of the block
  • See "None" as an option with the specified contentSize, but don't see the alignment-option for content-wide or full-width.

Screenshots, screen recording, code snippet

MicrosoftTeams-image

Environment info

  • WordPress 6.2 Beta 1 to 3
  • Gutenberg-Version must be anything between 14.2 - 15.1, tbh I don't know how to look up the exact Gutenberg version.

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@FabianKielmann
Copy link
Author

Just found this while further looking through the upcoming beta versions:

#47961

This seems to be the exact same problem with a fix already merged and probably coming in Beta 4 I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant