Opened 6 weeks ago
Last modified 9 days ago
#63549 assigned defect (bug)
Twenty Twenty-One: Line-height inconsistency in the editor with Lists and other blocks
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 6.9 | Priority: | normal |
Severity: | normal | Version: | 6.4 |
Component: | Bundled Theme | Keywords: | has-test-info has-screenshots has-patch |
Focuses: | css | Cc: |
Description (last modified by )
This ticket is a follow-up to #60196, which fixed margin differences between the editor and frontend. However, there's still a noticeable spacing issue due to a mismatch in line-height
.
As mentioned in comment:10:ticket:60196, the editor sets line-height
on the <html>
tag, while the iframe used in the editor applies line-height: normal
on the <body>
. This causes the text spacing in the editor to look slightly different from the frontend.
Backend Editor
Frontend
Attachments (2)
Change History (21)
This ticket was mentioned in PR #8940 on WordPress/wordpress-develop by @rishabhwp.
6 weeks ago
#1
- Keywords has-patch added
#2
@
6 weeks ago
- Description modified (diff)
- Milestone changed from Awaiting Review to 6.9
- Summary changed from Twenty Twenty-One: Line-height inconsistency in List Item blocks between editor and frontend due to reset styles – follow-up to #60196 to Twenty Twenty-One: Line-height inconsistency in List Item blocks between editor and frontend
- Version set to 6.4
Thanks for creating the ticket and a patch!
Version: 6.4 stopped converting html
and body
selectors to .editor-styles-wrapper
in the printed style tag.
#3
@
5 weeks ago
Reproduction Report
Description
This report validates whether the issue can be reproduced.
Environment
- WordPress: 6.8.1
- PHP: 8.2.27
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.35 / Client: mysqlnd 8.2.27)
- Browser: Edge 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-One 2.5
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Actual Results
- ✅ Error condition occurs (reproduced).
Additional Notes
Reproduction Steps:
Installed Twenty Twenty-One
Add unorder list and check the editor screen
When I add the list according to screenshot I face the issue related to space.
Please see the screen shot.
Supplemental Artifacts
Screenshot: https://prnt.sc/m4OmNwFhO0FL
#4
@
4 weeks ago
Attached a patch: https://prnt.sc/CDTiJUI2Vo8L
#5
@
4 weeks ago
- Keywords needs-testing added
Attached a patch: https://prnt.sc/CDTiJUI2Vo8L
Need to test.
#6
@
4 weeks ago
- Keywords changes-requested has-test-info added; needs-testing removed
Test Report
Description
❌ This report can't validate that the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/8940.diff
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-One 2.5
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Test Instructions
- Provided by here
Actual Results
- ❌ The patch is not solving the problem
Additional Notes
- On the other hand, the patch by dilip does solve the problem, but is not adequately made (and obviously not applying). It should be targeting one of the SCSS files and built them afterwards, just like the PR 8940 is doing. @dilip2615 can you adapt it to this format?
#7
@
4 weeks ago
I believe there’s a bit of confusion. My PR on this issue is a follow-up to a previous one. The original issue was reported in ticket #60196 , for which I initially submitted a PR here: https://github.com/WordPress/wordpress-develop/pull/8895.
Following a comment on that ticket (https://core.trac.wordpress.org/ticket/60196#comment:10), I was advised to open a separate ticket to specifically address the line-height
for both html
and body
elements.
This ticket and my PR targets that specific issue. For more context, please refer to the issue description.
#8
follow-up:
↓ 9
@
4 weeks ago
- Keywords changes-requested removed
If a ruleset like the margin revert
in 63549.patch is appropriate for all themes, but at zero specificity, that would belong in the Gutenberg styles (not the TinyMCE stylesheet). See GB42526.
For this ticket, 8940.diff correctly applies the theme's line-height
to List and Navigation blocks in the editor. If you want to see the List blocks match the front-end spacing within the editor, apply both 8940.diff and 8895.diff (or wait until one of them is committed).
If I had made a patch for this ticket, I would have grouped both the font-family
and line-height
in one ruleset for html
and body
, but I am not entirely convinced my way is better than PR 8940.
html, body { font-family: var(--global--font-secondary); line-height: var(--global--line-height-body); } body { --wp--typography--line-height: var(--global--line-height-body); color: var(--global--color-primary); background-color: var(--global--color-background); font-size: var(--global--font-size-base); font-weight: normal; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; }
#9
in reply to:
↑ 8
@
4 weeks ago
Replying to sabernhardt:
If a ruleset like the margin
revert
in 63549.patch is appropriate for all themes, but at zero specificity, that would belong in the Gutenberg styles (not the TinyMCE stylesheet). See GB42526.
Hard to test this one isolated. Why not integrating this directly #60196
I'm seeing reports covering half revamp of WP with 7 features at the same time, and others with just 3 characters struggling because "they cover too much".
Not so bald nor with three toupees…
#10
@
3 weeks ago
- Summary changed from Twenty Twenty-One: Line-height inconsistency in List Item blocks between editor and frontend to Twenty Twenty-One: Line-height inconsistency in the editor with Lists and other blocks
The margin issue (#60196) should only affect the List Item blocks.
The line-height
issue in Twenty Twenty-One affects more blocks. The theme's editor styles give a line-height
for paragraphs, headings, table cells and figcaption
elements. However, reset.scss
defines the line-height
as normal
for:
- List blocks
- Preformatted, Code and Verse blocks
- Navigation blocks
- the month (table
caption
) in Calendar blocks
As I said on #60196, I would not mind combining both pull requests into one testing process and/or one commit, but that would involve testing more blocks.
#11
@
3 weeks ago
- Keywords has-screenshots added
Test Report
Description
✅ This report validates that the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/8940
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.29.0
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-One 2.5
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Testing Instructions
- Add some blocks: Navigation with some elements and Preformatted blocks
- Add some background to the blocks to clearly see the limits of the block
- 🐞 Check the difference between the block editor and the front end. Is little but there is some difference
Expected Results
- Line Height should not be different between front and editor.
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
- Now with additional info provided here, I can clearly see the problem that has been causing confusion in #60196 (because this also happens to affect Lists, but since Lists have an even bigger problem with
data-blocks
margins that is like an elephant in the room, this little visual glitch is difficult to distinguish in that block.
Supplemental Artifacts
Preformatted/Navigation pre patch (PR8940)
Preformatted/Navigation with patch (PR8940)
#14
@
3 weeks ago
- Keywords commit removed
Putting hold on this as the other ticket has a fail right now in tests so need to see why that is happening and look at fixing before moving this to commit.
#15
follow-up:
↓ 16
@
3 weeks ago
I recommend merging this with the other issue so we can have one PR and then get that commited combined with #60196. This is an easier, calmer approach.
#16
in reply to:
↑ 15
@
3 weeks ago
Replying to karmatosed:
I recommend merging this with the other issue so we can have one PR and then get that commited combined with #60196. This is an easier, calmer approach.
Technically, you should not encounter any troubles between them both and as @sabernhardt explained, it seems that these two problems are unrelated. I have commented in #60196 why that one, was not passing.
Although if you like, you can pick both patches, merge them both at the same time (fixing the EOF in #60196), close this as duplicate to the other and send the revision in #60196 with "Fixes #60196 #63549"
PS: A nice trick that @joemcgill told me in Slack some months ago: Create a PR with the patches you are going to upload to GH before adding them into your local repo for SVN co, this way you will get a nice run on GHA and see what's going on before committing. Here more info.
Trac ticket: https://core.trac.wordpress.org/ticket/63549
This PR addresses a line-height inconsistency between the editor and the frontend. It follows up on [Trac ticket #60196](https://core.trac.wordpress.org/ticket/60196), which resolved margin issues but left a spacing difference due to how
line-height
is applied in the editor iframe.