Image missing alternative text can be inserted without error

Created on 28 March 2024, about 1 year ago
Updated 4 April 2024, about 1 year ago

Problem/Motivation

If an image has been added to the media library without alternative text, then subsequent attempts to insert that image into page content do not force supplying the missing alternative text.

I recognize that this would not normally happen on a manual image upload in the default Drupal configuration, but it could happen inadvertently as a result of a data upload or a temporary site misconfiguration.

Steps to reproduce

These steps are intended to create a testable case with minimal effort, so testers don't have to intentionally create a faulty data upload.

  1. Go to simplytest.me
  2. In the form field, type core
  3. Choose Drupal core
  4. Click to create the website with the latest version of Drupal core
  5. Once the site is created, login as admin
  6. In the administrator menu, click Extend
  7. In the form field, type media
  8. Enable Media and Media Library
  9. Click Configure
  10. Choose text formats and editors
  11. On the row for basic HTML click Configure
  12. Drag the media icon from Available Buttons to the Active Toolbar
  13. Under Enabled filters, check Embed media
  14. Under Filter settings, click Embed media
  15. Check Image
  16. Click Save configuration
  17. In the administrator menu, click Structure
  18. Click Media types
  19. On the row for Image, choose Manage fields from the drop-down
  20. On the row for image, click Edit
  21. Uncheck Alt field required
  22. Click save settings
  23. In the administrator menu, click Content
  24. Click Add content
  25. Click Basic page
  26. Click in the body WYSIWYG
  27. Click the media icon
  28. Click Choose files
  29. Navigate to a file and click Upload
  30. Do not type alternative text for the image
  31. Click save
  32. Click the X in the upper right corner to close the Add or save media dialog
  33. In the administrator menu, click Structure
  34. Click Media types
  35. On the row for Image, choose Manage fields from the drop-down
  36. On the row for Image, click Edit
  37. Check Alt field required
  38. Click save settings
  39. In the administrator menu, click Content
  40. Click Add content
  41. Click Basic page
  42. Click in the body WYSIWYG
  43. Click the media icon
  44. Check the checkbox for the image you just uploaded

    Option one:
    Expected result: A dialog box opens containing the Alternative text field, which is highlighted as being required.
    Actual result: Nothing happens.

    This is the issue filer's preferred option because it solves the issue for all future uses of this image.

  45. Click insert selected
  46. Type a page title
  47. Click save

    Option two:
    Expected result: Get error message that the image is missing alternative text. The editor would need to use the slashed eyeball icon to add the alternative text for that image on this page only.
    Actual result: Nothing happens.

    This is the issue filer's second choice because it solves the issue for this page only.

I would expect a similar solution for an image field that uses the media library.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
MediaΒ  β†’

Last updated 30 minutes ago

Created by

πŸ‡ΊπŸ‡ΈUnited States charles belov San Francisco, CA, US

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024