Make WordPress Core

Opened 2 years ago

Last modified 17 months ago

#61770 new defect (bug)

Twenty Nineteen: Preformatted block font size is not same in editor

Reported by: viralsampat Owned by:
Priority: normal Milestone: Future Release
Component: Bundled Theme Version: 5.0
Severity: normal Keywords: has-patch
Cc: Focuses: css

Description

Hello,

I have reviewed the "Preformatted block" and found that its font-size is not same in editor & front-end sides. I have checked this twenty-nineteen theme.

I think that it should be same on both editor & front-end sides.

Also, I have found same issue for other themes and posted it. #60993

Here, I have attached its screenshots.

Environment info:


  • WordPress version: WordPress 6.6.1 running,
  • Themes: Twenty Nineteen Version: 2.9
  • Browser: Google Chrome, Version 126.0.6478.183 (Official Build) (arm64)
  • Device: MacBook Air M1
  • OS: macOS 14.5 (23F79)
  • Gutenberg plugin: Version Version 18.8.0

Thanks,

Attachments (7)

Screenshot 2024-07-26 at 1.03.14 PM.png​ (523.9 KB ) - added by viralsampat 2 years ago.
Back-end
Screenshot 2024-07-26 at 1.11.31 PM.png​ (384.5 KB ) - added by viralsampat 2 years ago.
Front-end
SCR-20240727-jald.png​ (355.4 KB ) - added by karmatosed 2 years ago.
SCR-20240727-japb.png​ (416.6 KB ) - added by karmatosed 2 years ago.
61770.patch​ (1012 bytes ) - added by viralsampat 2 years ago.
I have checked above mentioned issue and I have resolved it and added patch. Also, I have attached screenshot after resolved this issue.
after-resolve-twenty-nineteen-pre-block-editor.png​ (234.4 KB ) - added by viralsampat 2 years ago.
Back-end
after-resolve-twenty-nineteen-pre-block-front-end.png​ (215.7 KB ) - added by viralsampat 2 years ago.
Front-end

Change History (13)

#1 @sabernhardt
2 years ago

  • Component General → Bundled Theme
  • Summary The Preformatted block font size is not same on editor & front-end side for twenty nineteen theme. → Twenty Nineteen: Preformatted block font size is not same in editor

#2 @sabernhardt
2 years ago

  • Keywords has-patch dev-feedback needs-testing removed

#3 @karmatosed
2 years ago

  • Keywords needs-patch added

I can confirm that this is the case in Twenty Nineteen. It is 22px in the editor but uses em on the front end. I would like to see a solution similar to the one I recommended in the other ticket of unifying using 1em or no declaration.

#4 @karmatosed
2 years ago

  • Milestone Awaiting Review → Future Release

@viralsampat
2 years ago

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

#5 @sabernhardt
2 years ago

  • Version 6.6.1 → 5.0

This ticket was mentioned in ​PR #9165 on ​WordPress/wordpress-develop by ​@rishabhwp.


17 months ago
#6

  • Keywords has-patch added; needs-patch removed

Trac ticket: https://core.trac.wordpress.org/ticket/61770

This pull request addresses a styling inconsistency in the Twenty Nineteen theme.

The theme sets a font-size for the preformatted block on the frontend (see _blocks.scss, line 346), but no corresponding font-size is defined for the editor. As a result, the preformatted block in the editor inherits the body font-size, creating a mismatch between editor and frontend styles.

This PR fixes that by explicitly setting the same font-size for the .wp-block-preformatted selector in the editor styles. It uses the $font__size-xs SCSS variable, which is used in _blocks.scss to set the font-size for preformatted block.

As the Twenty Nineteen theme uses SCSS, changes were made to the style-editor.scss file, and the build command was used to generate the corresponding CSS files.

Note: See TracTickets for help on using tickets.