Skip to content

Unnecessary blank line after linebreak when using formatted_body #9019

Open
@1MichaS1

Description

@1MichaS1

Steps to reproduce

  1. Where are you starting? What can you see?
    I write a text message in a room with the text editor activated on my Android phone with an explicit line break.
    For example I write:

hello nice
world.

Outcome

What did you expect?

I expect this text to appear exactly like that in the chat window, both on my own device and on the other user's Android device, i.e. only with simple line break but no blank line between "hello nice" and "world.".

On the Web browser interface (app.element.io) it gets displayed correctly as expected. But:

What happened instead?

But on all Android phones it appears as:

hello nice

world.

I.e. with an extra blank line between "hello nice" and "world.".

Technical background / root cause

The problem occurs when the raw data (as seen in app.element.io browser web interface) is like this:

"m.new_content": {
  "body": "hello nice\nworld.",
  "format": "org.matrix.custom.html",
  "formatted_body": "hello nice<br />world.",
  "msgtype": "m.text"
},

Wheres there's no problem for raw data like this:

"m.new_content": {
  "msgtype": "m.text",
  "body": "hello nice\nworld.",
  "m.mentions": {}
},

So the problem occurs in the rendering of formatted text, when the HTML tag

<br />

of "formatted_body" creates not only the desired line break but additionally a wrong extra blank line in the Android app (but not in the web browser app).

Your phone model

Shiftphone and Samsung

Operating system version

Android 10 and 14 likewise

Application version and app store

1.6.36 from Google Play

Homeserver

No response

Will you send logs?

No

Are you willing to provide a PR?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-DefectSomething isn't working: bugs, crashes, hangs and other reported problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions