[New Feature] Breaking Change - Text elements always handle leading whitespace

Hello everyone,

We’re about to release a small but important breaking change concerning display inside of text elements. Consider the following example:

Notice how the text I want to display has a newline at the beginning, but the text box isn’t displaying that. We would only display the leading newline in a small edge case, leading to seemingly inconsistent text rendering. Now, with Bubble version 10, we are always handling it correctly:

There are other small issues with whitespace that this fixes, such as paragraphs with leading whitespace, etc.

For those familiar with CSS, or want a more technical look, we are applying the “white-space: pre-wrap” property to text elements always (previously, we were only applying it in certain circumstances). See here: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

Once released, to opt in please visit the “Versions” subtab of the Settings tab to upgrade, and fix any issues in existing layouts you may have from this change. The “:trimmed” option on text may help if you want something similar to the old behavior, but I would manually confirm your text still displays the way you want.

25 Likes

@cal Nice! I rarely add leading whitespace, but do sometimes add a couple extra lines after a text. Will this impact those elements?

I don’t believe it should impact those elements, but when this is released you can try it out in your development version to make sure, and make tweaks to what is being displayed in the text elements.

2 Likes

I love this.
Thanks.

This is great. I would like to suggest also supporting proper vertical centering, and bottom alignment of text. It can be achieved via CSS, but it’s an extra step. For RGs with variable-length titles, vertical centering or bottom alignment is a must for a consistent UI.

8 Likes

Totally agree with you!!

1 Like

Hey @cal,

Today I’ve noticed a bug that didn’t exist before, it probably has something to do with this update.
The “rich text editor” that you access by clicking just below the text field is buggy.
Whenever I have dynamic data there, any change I make on the rich text breaks the text layout, and changes dynamic data into static data:

  1. I have this text setup manually:
    image

  2. Now I’m just going to make the “ID” bold:

  3. Aaaaaaaand, it broke:
    image

3 Likes

You guys rock. I love this platform.

2 Likes

I can confirm/second this behavior.

Yes that is good!

Btw, is there a way to force linebreak in a dyamic data text thing ? I really need this