Skip to content

Regression issue to style elements of a block through theme.json #55895

@renatho

Description

@renatho

Description

Style block elements were working in WordPress 6.3 and it's not working anymore (WP 6.4 or activating the latest version of Gutenberg - 17.0.0) for plugin blocks. I could make it work for the core paragraph block though.

Step-by-step reproduction instructions

  1. In a WordPress environment, add the following plugin to the wp-content/plugins folder: https://github.com/renatho/my-test-plugin
  2. Activate the plugin.
  3. Activate a block theme that uses theme.json. It could be the Twenty Twenty-Three.
  4. Edit the theme.json of the theme, and add the following customization under styles.blocks:
        "create-block/my-test-plugin": {
    	    "elements": {
    		    "link": {
    			    "typography": {
    				    "fontSize": "8px"
    			    }
    		    },
    		    "heading": {
    			    "typography": {
    				    "fontSize": "8px"
    			    }
    		    }
    	    }
        },
        "core/paragraph": {
    	    "elements": {
    		    "link": {
    			    "typography": {
    				    "fontSize": "8px"
    			    }
    		    }
    	    }
        },
  5. If not using WP 6.4, install and activate the Gutenberg 17.0.0. UPDATE: Install and activate the Gutenberg plugin.
  6. In the editor, create a page and add the "My Test Plugin" block.
  7. Also add a paragraph block and a link in the paragraph text (inside the paragraph block).
  8. Check that the styles work properly on the editor, but not on the frontend for the "My Test Plugin" block. And notice that it works for the core paragraph block.
  9. Check that it works properly on WordPress 6.3.

Screenshots, screen recording, code snippet

Editor with a paragraph with a link, and the "My Test Plugin" block with a blue background:

Screenshot 2023-11-06 at 11 30 43

The same page on the frontend:

Screenshot 2023-11-06 at 11 30 29

Environment info

  • Gutenberg 17.0.0 or WordPress 6.4
  • Chrome
  • OSX

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block Style VariationsIssues or PRs that are related to the style variations for blocks[Package] Style Engine/packages/style-engine[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions