superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.77k stars 323 forks source link

[bug] Multiline alt text tooltip includes indenting whitespace #3403

Open TheLastZombie opened 2 weeks ago

TheLastZombie commented 2 weeks ago

Describe the bug with a clear and concise description of what the bug is. Please include screenshots of any visual issues.

When submitting a post with an attachment that has an alt text which, in turn, consists of multiple lines, subsequent lines are indented in the tooltip displayed by the browser on hover.

What's your GoToSocial Version?

0.16.0+git-f1cbf6f

Browser version

LibreWolf 130.0-3 (also in Chromium)

What happened?

This is a snippet from a post on my profile:

                                                        <img
                                                            src="https://gotosocial.sny.sh/fileserver/01BG3X17KXSR2FSBSY9E6YGWWZ/attachment/small/01J9HPEQMSMRCPDNHBAHJ2KXWH.jpg"
                                                            loading="lazy"
                                                            alt="[hulk crying meme]
                                                        guys
                                                        I&#39;m starting to think about making my own text editor"
                                                            title="[hulk crying meme]
                                                        guys
                                                        I&#39;m starting to think about making my own text editor"
                                                            width="759"
                                                            height="900"
                                                        />

When hovering over the respective image, this tooltip appears:

image

What you expected to happen?

The lines should not be indented, and the tooltip should look like this:

image

How to reproduce it?

  1. Publish a post with an attachment with an alt text containing at least two lines of text.
  2. Hover over the attachment on your GoToSocial profile page.

Anything else we need to know?

According to the HTML Standard, LibreWolf/Chromium's behavior of not stripping the leading whitespace seems correct.

tsmethurst commented 2 weeks ago

Oh yeah I remember this. Seen the bug before, just didn't have an issue open for it yet. It's my bug and I know why it's happening :') Will fix when time permits.