WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.34k stars 4.13k forks source link

Using a shortcode block inside a Group block - Using alignment to make the shortcode block wider. #33886

Open paaljoachim opened 3 years ago

paaljoachim commented 3 years ago

Is there an existing issue for this?

Have you tried deactivating all plugins except Gutenberg?

Have you tried replicating the bug using a default theme e.g. Twenty Twenty?

Description

Using this plugin: https://wordpress.org/plugins/my-calendar/ and Twenty Twenty One. Going to the My Calendar page made by the plugin..

The default backend looks like this:

Screen Shot 2021-08-04 at 19 08 48

The frontend with Chrome Elements open.

Screen Shot 2021-08-04 at 19 12 23

The calendar shows width 100% inside the default Shortcode container a little further down and not seen in the above screenshot.

.mc-main.calendar, .mc-main table {
    width: 100% !important;
}

Adding the shortcode block into a Group.

Changing the Group block alignment to Wide width.

Backend. Screen Shot 2021-08-04 at 19 19 22

Frontend: Screen Shot 2021-08-04 at 19 23 46

Changing the Group block alignment to Full width.

Backend. Screen Shot 2021-08-04 at 19 19 38

Frontend. Screen Shot 2021-08-04 at 19 25 07

In theory the shortcode block should always show 100% width in the container it is in. It does not do so in this case.

Step-by-step reproduction instructions

  1. Download https://wordpress.org/plugins/my-calendar/ and install and activate. A My Calendar page should be created. If not then add this code into a shortcode block. [my_calendar id="my-calendar"]
  2. Test out the default width.
  3. Test out adding the shortcode block into a Group block.
  4. Test with Wide width and Full width alignments, and notice what happens in the backend and frontend.
  5. The shortcode is not following the block widths.

I do not know if this is because of missing code in the plugin or if this is an error in Twenty Twenty One. I also tested TT1 and the results where a little different. There I was able to get a wide width showing calendar in the frontend.

Associated issue: Adding the My Calendar shortcode to a Group block https://github.com/joedolson/my-calendar/issues/167

Expected Behavior

As the plugin has code to go 100% of the container it is in. I expected it to follow the width of the alignment in the Group block.

Current Behavior

Shortcode does not follow the alignment width of the Group block.

Screenshots or screen recording (optional)

Included above.

Code snippet (optional)

No response

WordPress Information

WordPress 5.8

Gutenberg Information

Gutenberg 11.2.0

I am also using the Theme Twenty Twenty One, and https://wordpress.org/plugins/my-calendar/

What browsers are you seeing the problem on?

Chrome

Device Information

Desktop

Operating System Information

OSX 11.5.1

paaljoachim commented 3 years ago

@getdave and @youknowriad

Adding a shortcode block into Twenty Twenty One and TT1 shows different alignment results when placed inside a Group block.

Gutenberg plugin 11.2.1 Chrome

Example using Twenty Twenty One theme. Shortcode block inside a Group block. Wide width alignment. Backend

Shortcode-block-inside-Group-using-TwentyTwentyOne

Frontend

Screen Shot 2021-08-16 at 15 11 43

Example using TT1 theme. Shortcode block inside a Group block. Wide width alignment. Backend

Screen Shot 2021-08-16 at 15 17 02

Full width alignment. Screen Shot 2021-08-16 at 15 19 05

Frontend Shortcode block inside a Group block. Wide width alignment.

Screen Shot 2021-08-16 at 15 22 04

Full width alignment.

Screen Shot 2021-08-16 at 15 21 43

I assume the difference in alignment between TT1 and Twenty Twenty One has to do with the Layout controls seen in the Side Editor.

An extra thought.... I believe that we now need to figure out a good method (I assume there is one) to have percentage/px control over the width of the wide block, so that we can define how wide Wide width should be for all blocks.

Thelmachido commented 2 years ago

It looks like the shortcode inside the group block becomes the same width as the one outside the group block if you make the group block full width.

https://user-images.githubusercontent.com/41231764/186428970-a646cabf-22c5-4596-8349-7eb1bfd8bd7b.mov

WordPress 6.0.1

Gutenberg 13.9.0