New line-height control: user interface shortcomings and inaccurate preview #23895
Labels
[Feature] Design Tools
Tools that impact the appearance of blocks both to expand the number of tools and improve the experi
[Feature] UI Components
Impacts or related to the UI component system
[Type] Bug
An existing feature does not function as intended
Describe the bug
Splitting this out from #20775 (comment)
The new line-height control that is going to be introduced in WordPress 5.5 offers room for improvements, both in terms of usability of the user interface and in the accuracy of the line-height preview in the editor.
In its current state I'd define this new feature unpolished and unfinished. Not my intent to dismiss the work done here but it really feels like an incomplete, bit rushed, new feature that is going to be released a bit too early. In my opinion, it would need a few tweaks before it's really "ready" to be offered to users.
User interface shortcomings
1.476
for the content paragraphs. The line-height control UI doesn't allow to set this value other than manually. The0.1
step value for the number input type doesn't seem appropriate. I wonder whether a number input is appropriate in the first place but I can't think of of a better control off the top of my head.1.5
is highly confusing. At first sight, it seems the default value, while the actual value from the theme may be completely different. Not sure there's a reason to display the placeholder in the first place and I'd tend to think it should be removed. Noting that the font-size custom value doesn't use a placeholder, for good reasons.1.5
with a dot. As a result:1.5
This is highly confusing and one more reason to remove the placeholder. 4. The `max-width: 60px;` on the number input seems an arbitrary value to me and definitely too small for values with several decimals.
Implementation considerations
editor-font-sizes
the should be required to pair a set of line-height values for each present font-size. Only this way, the line-height value makes sense because it's crafted on a specific font-size value. This would help consistency in the design and mitigate the "HTML soup" problem. Users can always set a custom value if they'r enot satisfied with the presets one.editor-font-sizes
, the block editor should provide sets of preset line-height values for each defaults in thefontSizes
array. Again, only this way line-height values can be well-crafted in relationships to the actual font-size value.Inaccurate preview in the editor
This is actually very clear with Twenty Twenty and it's also related to some recent changes to the
editor-styles-wrapper
styles. I think (not 100% sure) they come from #21428Regardless, as said above Twenty Twenty uses a line-height of
1.476
for the content paragraphs. Screenshot from the front end:Twenty Twenty CSS related values for large screens:
This is the preview in the block editor: the line height is clearly taller:
While Twenty Twenty correctly sets the editor style so that the paragraph line-height value is
inherit
:In the context of the editor, the inherited value comes from the editor CSS:
Thus, the computed line-height value is
37.8px
instead of30.996px
.While it appears themes can set a line-height for the
editor-styles-wrapper
, it seems to me it won't have effect because of the order of the styles, unless themes use!important
. So to recap:editor-styles-wrapper
styles can be overridden because of the styles order, unless by using!important
1.8
as line-height to start with. Seems an arbitrary value to me also considering the default font-size is 16px:$editor-font-size: 16px;
$editor-line-height: 1.8;
28.8px
Certainly Twenty Twenty could improve a bit its editor styles but the styles order seems a problem that should be fixed.
The text was updated successfully, but these errors were encountered: