feat: Add alt description support for image uploads

Merged
DO
6mo ago
+139-55

Proposed changes (including videos or screenshots)

Depends on #40067

image
  • Add a "Description" input to the file upload modal, shown only for images, to let users set alt text
  • Wire the description through the upload store, composer, and API to the server
  • Map the description field to the alt attribute on rendered <img> tags for accessibility
  • Support E2E encrypted uploads by including description in encrypted metadata and attachment payloads
  • Remove description from non-image attachment creation on the server (audio, video, generic) since it's no longer rendered

Test plan

  • Upload an image in a regular room — verify the modal shows a "Description" input with placeholder text
  • Fill in a description, send — verify the <img> tag has the correct alt attribute
  • Upload an image without filling description — verify alt defaults to empty string
  • Upload a non-image file — verify no description input appears in the modal
  • Edit a file's name via the modal — verify description is preserved
  • Upload an image in an E2E encrypted room — verify description is encrypted and renders correctly after decryption
  • Copy/report a file message — verify no regressions
  • Check the Room Files contextual bar — verify image thumbnails use description as alt text as well

Issue(s)

Steps to test or reproduce

Further comments

WA-17

Summary by CodeRabbit

  • New Features
    • Added alternative text field for image uploads, allowing users to provide descriptions for improved accessibility and screen reader support