Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 22 months ago

#61126 closed defect (bug) (worksforme)

Twenty Nineteen: Read More block is too wide in the editor

Reported by: pitamdey's profile pitamdey Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: close
Focuses: ui, css Cc:

Description

in the Twenty Nineteen theme, The Read More block width is different in the editor & frontend.
I have also attached a screenshot for better understanding

Attachments (5)

Screenshot 2024-05-02 at 3.00.12 PM.png (235.9 KB) - added by pitamdey 2 years ago.
Editor View
Screenshot 2024-05-02 at 3.00.21 PM.png (156.5 KB) - added by pitamdey 2 years ago.
Frontend View
61126.patch (455 bytes) - added by pitamdey 2 years ago.
After applying this solution the issue is resolved
readmore-65.png (9.0 KB) - added by poena 2 years ago.
6.5, before patch
readmore-trunk.png (9.0 KB) - added by poena 2 years ago.
Trunk, before patch

Download all attachments as: .zip

Change History (16)

@pitamdey
2 years ago

After applying this solution the issue is resolved

#1 @pitamdey
2 years ago

I have compared this with other themes and found that we have to make changes for the editor side. So I have added a patch accordingly

@poena
2 years ago

6.5, before patch

@poena
2 years ago

Trunk, before patch

#2 @poena
2 years ago

Hi @pitamdey
Thank you for reporting and working on this issue.
Is there a way to solve it without using important?


Ideally the theme should not be setting the max width and width like this, then we would not need to override it for this block, but maybe it was needed for older versions of WordPress.


@isabel_brison
There is a visible difference between the padding on this block in 6.5 and trunk, so at first, I was confused about why my test showed a different result than the screenshots that were added to this ticket.
In both tests, the block has a background color added.

I am not sure that this spacing change is intentional.
This should be explored further. I do not see any changes to the padding in the block's history:
https://github.com/WordPress/gutenberg/commits/trunk/packages/block-library/src/read-more

6.5:

element.style {
    white-space: pre-wrap;
    min-width: 1px;
    background-color: rgb(0, 115, 168);
    padding-top: var(--wp--preset--spacing--40);
    padding-right: var(--wp--preset--spacing--40);
    padding-bottom: var(--wp--preset--spacing--40);
    padding-left: var(--wp--preset--spacing--40);
}

Trunk:

element.style {
    white-space: pre-wrap;
    min-width: 1px;
    background-color: rgb(0, 115, 168);
}

#3 @poena
2 years ago

  • Keywords 2nd-opinion added

This ticket was mentioned in PR #6506 on WordPress/wordpress-develop by @sabernhardt.


2 years ago
#4

  • Keywords has-patch added

Applies the Read More block's width in the theme by adding more classes (total of three when combined with .editor-styles-wrapper):

.editor-styles-wrapper .wp-block-read-more.wp-block-read-more {
  width: -moz-fit-content;
  width: fit-content;
}

to override

.editor-styles-wrapper .wp-block .wp-block {
  width: initial;
}

Trac 61126

#5 @sabernhardt
2 years ago

  • Focuses css added
  • Summary changed from Twenty Nineteen : Read More block width issue to Twenty Nineteen: Read More block is too wide in the editor

Adding one more class should be enough to avoid using !important, and I do not find a need to repeat display: block in the theme styles.

@sabernhardt commented on PR #6506:


2 years ago
#6

I switched this to .wp-block.wp-block-read-more so it does not look like a mistake.

#7 @isabel_brison
2 years ago

@poena I can't reproduce that padding on 6.5.2 with Twenty Nineteen.

Was the markup you used created with the Twenty Nineteen theme active? Those wp--preset--spacing properties are usually generated by global styles, so I wouldn't expect to see them on a classic theme.

I switched this to .wp-block.wp-block-read-more so it does not look like a mistake.

Fwiw I personally prefer the classname repetition, as it makes it clear that the intent is to bump up specificity.

#8 @poena
2 years ago

I reset my WP install including the theme (version 2.8) and I can't reproduce the padding issue anymore.

#9 @karmatosed
2 years ago

  • Keywords close added; has-screenshots 2nd-opinion has-patch removed

I am unable to reproduce this myself so for now I am going to recommend this is closed. If anyone can we can always reopen.

#10 @karmatosed
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I am going to follow through and close this, thank you everyone.

@sabernhardt commented on PR #6506:


22 months ago
#11

The ticket is closed, without changing the theme.

Note: See TracTickets for help on using tickets.