In https://github.com/google/web-stories-wp/issues/3530 we removed the whitespace of the text element so there would be no whitespace no matter the line-height.
There seems to be a regression in the front-end.
Editor:

The Front-end:

This causes additional oddities when assigning inner/center border since the border is added based on the expected text element size, not how it currently is:
Editor with inner border:

FE with inner border:

_Do not alter or remove anything below. The following sections will be managed by moderators only._
Please also ensure that we add any additional padding to the text box to make applying border beautiful. The same rule that applies for text box fill should apply here.
Can we change the editor sizing of text boxes rather than the rendered output (i.e. fix calculation of text bounding boxes with line height in editor)?
I think it actually looks better to respect line height at the top/bottom of the text box. I.e. the "front-end" screenshot looks better than the "editor" screenshot.
This will cause visual regressions in users' stories that rely on the current text box sizing behavior. But it's already affecting the output of their stories, so arguably it's better to be consistent.
I wonder if we can change the editor sizing of text boxes rather than the rendered output (i.e. fix calculation of text bounding boxes with line height in editor). I think it actually looks better to respect line height at the top/bottom of the text box.
In terms of the looks -- if I understood @samitron7 correctly then there's a high priority issue coming for adding padding to the text to each side when the text element has background, this would fix the looks issue.
Can we change the editor sizing of text boxes rather than the rendered output (i.e. fix calculation of text bounding boxes with line height in editor)?
Essentially this would mean adding space between the edges and the content. What about the case when there is no background set and it's just text -- should there still be space between the text and the selection box in the editor? Thoughts?
@miina 4980 is in review and should address the default padding for hi-hi-lite fill.
Would it be possible to see screenshot of what the text box (with no bg fill) looks like with the fix calculation?
@samitron7 If we'd follow Will's suggestion and change the editor boxing instead of restoring the output how it was before, then this would mean that in the editor there would be space between the selection line even when there is no background assigned (that happens in the output as well, it's just not visible without a background). Then it would look something like this without the background:

Currently, there is no space:

What about the case when there is no background set and it's just text -- should there still be space between the text and the selection box in the editor? Thoughts?
I think that's actually desirable since it shows the user what the area of a fill background would be (before any is set).
I think that's actually desirable since it shows the user what the area of a fill background would be (before any is set).
Sure! Note that this would influence snapping -- if the user would want to align/snap the text content to another element etc. very precisely they'd need to do that manually since snapping is based on the selection box, but perhaps that's acceptable.
@miina Before we do this, can you make sure that
1) Text sets are not badly impacted. If they are, we'll need to file a ticket to fix them.
2) Marcin's work to remove the trailing whitespace is not in conflict with this fix. The work was originally started when I reported that setting line height to 5 on a text box pushed the text down leaving a very large white gap at the top of the text box.
@samitron7 Thanks for bringing up these points. We'd need more precise UX guidelines for the change before doing this and there are some concerns indeed, including the text sets. Depending on the requirements, we might still need to adjust the preview/output as well, too.
There are quite a few details and influenced parts here. For the purposes of just fixing the bug, it could be worthwhile to also look into fixing the issue in the preview/output instead (remove the extra space that came from the regression) -- if that's an easy fix then we could first do the fix and then follow up in a separate PR with added whitespace as suggested, addressing all the parts involved.
Thoughts?
@miina what does fixing the issue in the preview/output entail? I want to get some clarity on that before I look into the other things.
@samitron7 The original regression came from a change in the preview, not in the editor -- in the preview, previously, everything that was outside of the borders of the text element (any overflow) was hidden in the output. However, since some of the characters were partially cut off this way as well, then the overflow was made visible again within #3530. This caused a regression because previously, when removing the line-height extra whitespace (the work that Marcin did), some of the extra whitespace was hidden by this same overflow. Now when it was displayed again in #3530, the extra space appeared, too, causing the regression.
This means that the editor logic hasn't been influenced at all by this regression, it's just the output (preview) that has changed, and instead of fixing the regression by changing the editor view to match the output, we could instead at first look into fixing the preview that got "broken" in the first place.
I'm in favor if of that since fixing the issues inside the editor will cause a slew of other issues that you pointed out. Can you we look into fixing the preview.
@barklund @bmattb FYI Pulling this into Sprint to work on it.
verified in qa
Nice work fixing this @miina! 馃帀
Verified in UAT