Make WordPress Core

Opened 2 years ago

Closed 23 months ago

#56049 closed defect (bug) (fixed)

Twenty Twenty: Width discrepancy between editor and preview when nested in cover block

Reported by: mrfoxtalbot's profile mrfoxtalbot Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: minor Version: 6.0
Component: Bundled Theme Keywords: has-patch has-screenshots
Focuses: Cc:

Description

Headings inside a cover block appear too wide in the editor, but look fine later in the published post.

To reproduce

  • Create a new post or a page. Add a cover block with an image background, set the cover block to Full width.
  • Inside the cover block add a headings block.
  • For comparison, add a paragraph block below the heading.
  • Notice the different width and alignment between the two.
  • Save draft and go preview the post/page. Notice the paragraph and heading are both the same width.
  • A similar thing happens when headings block is nested in the group block set to wide or full width.

Expected behavior

For the editor to match the preview.

Attachments (6)

Screen Shot on 2022-06-23 at 11:16:59.png (3.5 MB) - added by mrfoxtalbot 2 years ago.
Twenty Twenty: heading nested inside cover width discrepancy in Editor
Screen Shot on 2022-06-23 at 11:17:12.png (4.0 MB) - added by mrfoxtalbot 2 years ago.
Twenty Twenty: heading nested inside cover width discrepancy. Public view
56049.diff (647 bytes) - added by tahmidulkarim 2 years ago.
Patch created
Capture d’écran 2022-09-14 à 21.20.11.png (3.5 MB) - added by audrasjb 23 months ago.
Front end
Capture d’écran 2022-09-14 à 21.23.09.png (4.7 MB) - added by audrasjb 23 months ago.
Before patch
Capture d’écran 2022-09-14 à 21.22.32.png (4.7 MB) - added by audrasjb 23 months ago.
After patch: fixed!

Change History (19)

@mrfoxtalbot
2 years ago

Twenty Twenty: heading nested inside cover width discrepancy in Editor

@mrfoxtalbot
2 years ago

Twenty Twenty: heading nested inside cover width discrepancy. Public view

#1 @mrfoxtalbot
2 years ago

This bug was reported originally here https://github.com/WordPress/gutenberg/issues/25937

There is similar issue affecting Twenty Twenty-One here:
https://core.trac.wordpress.org/ticket/56050

Last edited 2 years ago by mrfoxtalbot (previous) (diff)

#2 @mrfoxtalbot
2 years ago

  • Version set to 6.0

#3 @tahmidulkarim
2 years ago

Removing max-width: 100% from .wp-block-cover h2 seems to solve the issue. I have attached a patch.

@tahmidulkarim
2 years ago

Patch created

#4 @tahmidulkarim
2 years ago

  • Keywords has-patch needs-testing added

#5 @NomNom99
2 years ago

  • Keywords needs-testing removed

Test Report

Environment

WordPress: 6.1-alpha-53344-src
Browser: Chrome, version 104.0.5112.79 (Official Build) (x86_64)
Operating System: macOS Monterey 12.4

Steps to test

  1. Clone WordPress-develop using git@github.com:WordPress/wordpress-develop.git
  2. Setup WordPress using this instruction
  3. Pull the changes of this patch using the command npm run grunt patch:56049

Results

  • ✅ The patch is working as intended but only for the Twenty Twenty theme.
  • ❌ Doesn't work for Twenty Twenty-One theme.

Should the fix for Twenty Twenty-One be a separate issue or would it be a good idea to fix in here?

#6 @tahmidulkarim
2 years ago

Thank you for testing the patch @NomNom99. The patch is intended to work only for the Twenty Twenty theme. For Twenty Twenty-One theme there is already a separate issue raised here: #56050

Last edited 2 years ago by SergeyBiryukov (previous) (diff)

#7 @NomNom99
2 years ago

Awesome! Thanks for the info @tahmidulkarim

Test Report

Environment

WordPress: 6.1-alpha-53344-src
Browser: Chrome, version 104.0.5112.79 (Official Build) (x86_64)
Operating System: macOS Monterey 12.4

Steps to test

  1. Clone WordPress-develop using git@github.com:WordPress/wordpress-develop.git
  2. Setup WordPress using this instruction
  3. Pull the changes of this patch using the command npm run grunt patch:56049

Results

  • ✅ The patch is working as intended for the Twenty Twenty theme.

This ticket was mentioned in Slack in #core by tahmidulkarim. View the logs.


2 years ago

#9 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.1

#10 @audrasjb
23 months ago

  • Keywords changes-requested added

The patch needs to be reported on the RTL stylesheet as well.

#11 @audrasjb
23 months ago

  • Keywords has-screenshots added; changes-requested removed

Alright the patch works fine. I'm removing the changes-requested keyword since I'll add the RTL change directly during commit ;)

#12 @audrasjb
23 months ago

  • Owner set to audrasjb
  • Status changed from new to accepted

#13 @audrasjb
23 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 54163:

Twenty Twenty: Fix Heading Block alignment when nested in Cover Block.

This brings consistency between block editor and front-end rendering.

Props mrfoxtalbot, tahmidulkarim, NomNom99, audrasjb.
Fixes #56049.

Note: See TracTickets for help on using tickets.