Make WordPress Core

Opened 4 months ago

Last modified 2 weeks ago

#61138 new enhancement

Twenty Nineteen: Latest Posts block top/bottom spacing is not same on editor side and front-end side when we change its background.

Reported by: viralsampat's profile viralsampat Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 6.5
Component: Bundled Theme Keywords: needs-refresh 2nd-opinion
Focuses: ui, css Cc:

Description

Hello,

I have reviewed "Latest Post" block and found that when we are trying to change it background color, Its text color and top/bottom space are not same on editor side & front-end side.

I think that it should be same on both sides(Editor & Front-end)

Here, I have attached its screenshots:

Thanks,

Attachments (5)

latestpost_editor.png (233.1 KB) - added by viralsampat 4 months ago.
Back-end
latestpost_front_end.png (128.7 KB) - added by viralsampat 4 months ago.
Front-end
61138.patch (5.9 KB) - added by viralsampat 4 months ago.
I have checked above mentioned issue and I have resolved it and added patch. Also, I have attached screenshot after resolved this issue.
latest-post-block-back-end.png (230.1 KB) - added by viralsampat 4 months ago.
After resolved issue Back-end:
latest-post-block-front-end.png (152.7 KB) - added by viralsampat 4 months ago.
After resolved issue front-end:

Download all attachments as: .zip

Change History (7)

@viralsampat
4 months ago

Back-end

@viralsampat
4 months ago

Front-end

@viralsampat
4 months ago

I have checked above mentioned issue and I have resolved it and added patch. Also, I have attached screenshot after resolved this issue.

@viralsampat
4 months ago

After resolved issue Back-end:

@viralsampat
4 months ago

After resolved issue front-end:

#1 @karmatosed
4 months ago

  • Keywords needs-refresh added; dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release

I can confirm this is an issue. However, I think we need a different approach to the patch. First up there seem to be other things in this patch we might not need. Secondly, I think just leveling up the spacing is a gentler approach. We need to think that others might find any change a little unexpected so how can we do this as small as possible.

#2 @sabernhardt
2 weeks ago

  • Keywords 2nd-opinion added
  • Summary changed from Twenty Nineteen: Latest post block text color and top/bottom spacing are not same on editor side and front-end side when we change its background. to Twenty Nineteen: Latest Posts block top/bottom spacing is not same on editor side and front-end side when we change its background.
  • Type changed from defect (bug) to enhancement

Let's keep the discussion about automatic contrast text colors with background on #49931.

For the padding, WordPress 6.6 fixed the discrepancy between the editor and front. The lower :root :where() specificity stopped overriding the theme's setting of zero padding for the Latest Posts block in the editor. On the front, the theme's specificity already was higher.

Editor:

/* Twenty Nineteen style-editor.css */
.wp-block-latest-posts {
  padding: 0;
}

/* block-library/style.css */
:root :where(ul.has-background, ol.has-background) {
  padding: 1.25em 2.375em;
}

/* block-library/editor.css */
:root :where(.wp-block-latest-posts) {
  padding-left: 2.5em;
}
:root :where(.wp-block-latest-posts.is-grid), :root :where(.wp-block-latest-posts__list) {
  padding-left: 0;
}

Front:

/* Twenty Nineteen style.css */
.entry .entry-content .wp-block-latest-posts {
  padding: 0;
}

/* block-library/style.css */
:root :where(.wp-block-latest-posts.wp-block-latest-posts__list) {
  padding-left: 0;
}
:root :where(ul.has-background, ol.has-background) {
  padding: 1.25em 2.375em;
}

The block might look better with a small amount of padding on all sides whenever it has a background color, but that would be an enhancement. *If* this is a good idea, I would suggest 0.5rem on the front and 11px (0.5 * $font__size_base) in the editor.

Note: See TracTickets for help on using tickets.