Open mrwweb opened 8 months ago
I agree that ideally the same CSS should be applied in the editor and front.
Contributors have spent a lot of time and effort to make the font size, line height and appearance settings work for the quote and pullquote blocks in the classic bundled themes, so any changes to this needs to be tested extensively.
Contributors have spent a lot of time and effort to make the font size, line height and appearance settings work for the quote and pullquote blocks in the classic bundled themes, so any changes to this needs to be tested extensively.
I have tested all default themes from Twenty Nineteen to Twenty Twenty-Four I tested the Quote and Pullquote blocks with a multi-line citation. My findings were that themes occasionally had custom styles that fixed this, but not always.
For each theme, I tried adding the following rule:
cite {
display: block;
}
In every case, this fixed the line-height issue and did not change anything else. As expected, text-alignment was not impacted.
I have screenshots of both before and after if people need to see this.
Conclusion: Every default theme built since the block editor appears to be either improved or unchanged with this fix for cite
line-height.
Description
(I debated whether this is a Twenty Twenty-Four bug or something upstream and think it belongs in the Gutenberg repo.)
Current things that are true:
cite
elementcite
elementsfont-size
andline-height
viatheme.json
cite
is aninline
element by defaultinline-block
orblock
to honorline-height
correctly based on their font-size (Tested in Chrome and Firefox. Reduced test case)This problem is already avoided in the editor due to an inline style of
display: block
oncite
elements. However, that style is not present on the front, leading to really bad line-height issues unless a theme proactively addsdisplay: inline-block;
ordisplay: block
tocite
elements.This issue is present in Twenty Twenty-Four (see screenshots). I believe Twenty Twenty-Three has a custom style to handle this.
Since
theme.json
implies it's possible to set aline-height
forcite
and that line height works in the editor, I believe there should automatically be a front-end style ofcite { display: block; }
for all sites by default.Step-by-step reproduction instructions
See reduced test case on CodePen
Screenshots, screen recording, code snippet
Twenty Twenty-Four demo site with extra long citation added via dev tools:
From a modified theme based on Twenty Twenty-Four:
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes