[Bug]: Missing alt text on images, keyboard-inaccessible image attachments, and missing Escape key handling in ImageGallery

Ouverte
#1,463 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@Siddh2024 y travaille déjà.

Depuis le 24/11/2026.

  • #1464 par @Siddh2024 — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
40/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
javascript, react

Piste de recherche

Start in packages/react/src/views/AttachmentHandler/ImageAttachment.js (trigger around lines 97-113, <img> at 98 and 162), then packages/react/src/views/AttachmentPreview/PreviewType/image.js:9 and packages/react/src/views/ImageGallery/ImageGallery.js (slide at 107, close button 47-53). Reproduce in Storybook first: Tab should skip the attachment, Escape should not close the gallery. Done means alt fallbacks on every <img>, a role="button"/tabIndex/onKeyDown trigger, an aria-label on the exit button, and Escape closing the modal. Note pull request #1464 is already open against this, so it is effectively claimed.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug
Description:

Image attachments and the full-screen ImageGallery modal in @embeddedchat/react contain several accessibility and keyboard navigation compliance issues:

  1. Missing alt Attributes on <img> Tags (WCAG 1.1.1 Non-text Content - Level A):

    • In packages/react/src/views/AttachmentHandler/ImageAttachment.js (lines 98 and 162), <img src={...} /> elements lack an alt attribute.
    • In packages/react/src/views/AttachmentPreview/PreviewType/image.js (line 9), the upload preview image lacks an alt attribute.
    • In packages/react/src/views/ImageGallery/ImageGallery.js (line 107), full-screen gallery slides lack an alt attribute.
      Without alt text, screen readers announce raw URLs to blind users or ignore the images completely.
  2. Keyboard-Inaccessible Image Preview (WCAG 2.1.1 Keyboard Navigation):

    • In ImageAttachment.js (lines 97 and 113), the container that opens the image gallery is rendered as a plain <div> (<Box onClick={() => setShowGallery(true)}>).
    • It lacks role="button", tabIndex="0", an accessible label, and keyboard listeners (Enter / Space). Keyboard-only users cannot tab to or open full-size image attachments.
  3. Missing aria-label and Escape Key Listener in ImageGallery (WCAG 4.1.2 & WCAG 2.1.2):

    • In ImageGallery.js (lines 47-53), the close button (<ActionButton css={styles.exit} onClick={() => setShowGallery(false)}><Icon name="cross" /></ActionButton>) lacks an aria-label="Close image gallery". Screen readers announce it as a bare "Button".
    • When the gallery modal is open full-screen, pressing the Escape key does not dismiss the modal.

Steps to reproduce:
  1. Open EmbeddedChat in Storybook or live chat.
  2. View an image attachment in chat history.
  3. Inspect the DOM in browser DevTools: observe that the <img> tag has no alt attribute.
  4. Try navigating to the image attachment using only the keyboard (Tab): observe that focus completely skips the image, making it impossible to open the gallery via keyboard.
  5. Click the image with a mouse to open the ImageGallery modal.
  6. Press the Escape key: observe that the modal does not close.
  7. Inspect the exit button: observe that it lacks an aria-label.

Expected behavior:
  • All <img> tags should have descriptive or fallback alt attributes (e.g. attachment.title || attachment.description || 'Image attachment').
  • Clickable image attachment containers should have role="button", tabIndex="0", a descriptive aria-label="View full image", and open on Enter / Space key presses.
  • The ImageGallery exit button should have an aria-label="Close image gallery".
  • Pressing Escape in ImageGallery should close the modal and return focus to the triggering element.

Proposed Solution:

I would like to resolve this in @embeddedchat/react:

  • Add proper alt attributes to images in ImageAttachment.js, PreviewType/image.js, and ImageGallery.js.
  • Make the image attachment trigger an accessible button (role="button", tabIndex={0}, and onKeyDown handling for Enter and Space).
  • Add an aria-label to the exit button and an Escape key event listener in ImageGallery.js.

May I be assigned this issue?

Langage dominant
JavaScript
Étoiles
171
Forks
421
Merge moyen
3 j 6 h
PR mergées (30 j)
4

Préparer son environnement

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de RocketChat/EmbeddedChat

Toutes les issues de RocketChat/EmbeddedChat

Issues similaires

Plus d'issues JavaScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.