Fix: Unset line heights on stretch text#74041
Fix: Unset line heights on stretch text#74041jorgefilipecosta wants to merge 2 commits intotrunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +29 B (0%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in ff93f76. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20269254762
|
|
Hi @jorgefilipecosta, thanks for working on the fix. I can confirm it works with some unconventional but valid line height values 🎉 I also noticed that the line height control is disabled in the typography settings in the editor. It's still useful for the fitted text to control the vertical height of the text. Is there any way to keep it? |
|
This is not quite working, as the line-height control is still visible after enabling fit text: Screen.Recording.2026-01-02.at.16.37.58.movIf the intent is to ignore line-height when fit text is enabled, I wonder if we could remove the line-height styles from the block as well? I reckon unsetting line-height in common.css may still be necessary for global styles, though. |
|
@oandregal Thanks for looking into it. As I mentioned above, we need a working line-height control for the fitted text so we can adjust its height in the design. Without it, we'll have unwanted big gaps around it. |
|
It's probably reasonable to set the line height to |
|
Hi @jorgecontreras, could you look at this again when you have a chance? 🙏 It would be great if we could make FitText work on the text with a complex line height value while keeping the line height control. Let me know if there is anything I can help you with. |
|
This PR was featured in today's 6.9.1 bug scrub. From what I can tell, this issue occurs when the line-height value is less than 1, or when a function is used. Values greater than 1 work fine. Perhaps we need to find an approach that will make fit-text work regardless of the line-height value. |
|
Hi @t-hamano, @iamtakashi I proposed an alternative fix at #74860. |

Fix: #73806
Line heights limits the height of a text block, on fit text we try to maximize the size of a given text block inside its available dimensions. Both options are fundamentally against each other, in the same way fit text is fundamentally against white-space wrapping and line heigh. Having fit text together with a line height at the block does makes sense adn could have unpredictable results.
This PR adds change to make sure line heigh is removed when fit text is enable.
cc: @iamtakashi
Testing
Paste the following on the code editor:
Covert the block to Stretch Paragraph.
Verify text stretches (trunk it does not).