feat: Add alt description support for image uploads
Merged
DO
6mo ago+139+139+012345678901234567890123456789-55-55-01234567890123456789
Proposed changes (including videos or screenshots)
Depends on #40067
- 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
descriptionfield to thealtattribute on rendered<img>tags for accessibility - Support E2E encrypted uploads by including description in encrypted metadata and attachment payloads
- Remove
descriptionfrom 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 correctaltattribute - Upload an image without filling description — verify
altdefaults 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
Summary by CodeRabbit
- New Features
- Added alternative text field for image uploads, allowing users to provide descriptions for improved accessibility and screen reader support