elk-zone / elk

A nimble Mastodon web client
https://elk.zone
MIT License
5.52k stars 565 forks source link

Alt text is too wide #2890

Open Christopher-Hayes opened 5 months ago

Christopher-Hayes commented 5 months ago

Description

Alt text on desktop screens is really wide, it's not good for readability.

Screenshots

image

image

Proposed Solution

If we match the max-width of Mastodon posts (600px), we get:

image

image

For longer alt text (like the 2nd screenshot), we could clamp it at 3 lines:

image

Code from proposed solution

Parent div:

max-width: 600px;
border-radius: 12px; /* full rounded doesn't look good on multiple lines */

Alt text p:

[line-clamp-3] {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

Related Issues

Alt text should be wrapped #2509

stackblitz[bot] commented 5 months ago

Solve in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

Christopher-Hayes commented 5 months ago

Unrelated - While I'd prefer to invite discussion and get sign-off from a maintainer before starting a PR, I did try the "Solve in Codeflow" button above. However, the setup script failed with:

│ ✔ Types generated in .nuxt
│ > @elk-zone/elk@0.14.0 prepare-translation-status /home/elk-zone/elk
│ > tsx scripts/prepare-translation-status.ts
│ TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/elk-zone/elk/scripts/prepare-translation-status.ts
...
│ Node.js 18.20.3
│  ELIFECYCLE  Command failed with exit code 1.
│ Process exited with code: 1
└─ Failed in 17.6s at /home/elk-zone/elk
 ELIFECYCLE  Command failed with exit code 1
mojoaxel commented 4 days ago

A similar problem exists on mobile. If the alt text is too long it gets cut off with an ellipsis. I think alt-texts should auto wrap like proposed here.

Screenshot_20241119-221458.png