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.
- Go to simplytest.me
- In the form field, type core
- Choose Drupal core
- Click to create the website with the latest version of Drupal core
- Once the site is created, login as admin
- In the administrator menu, click Extend
- In the form field, type media
- Enable Media and Media Library
- Click Configure
- Choose text formats and editors
- On the row for basic HTML click Configure
- Drag the media icon from Available Buttons to the Active Toolbar
- Under Enabled filters, check Embed media
- Under Filter settings, click Embed media
- Check Image
- Click Save configuration
- In the administrator menu, click Structure
- Click Media types
- On the row for Image, choose Manage fields from the drop-down
- On the row for image, click Edit
- Uncheck Alt field required
- Click save settings
- In the administrator menu, click Content
- Click Add content
- Click Basic page
- Click in the body WYSIWYG
- Click the media icon
- Click Choose files
- Navigate to a file and click Upload
- Do not type alternative text for the image
- Click save
- Click the X in the upper right corner to close the Add or save media dialog
- In the administrator menu, click Structure
- Click Media types
- On the row for Image, choose Manage fields from the drop-down
- On the row for Image, click Edit
- Check Alt field required
- Click save settings
- In the administrator menu, click Content
- Click Add content
- Click Basic page
- Click in the body WYSIWYG
- Click the media icon
- 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.
- Click insert selected
- Type a page title
- 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
Issue fork drupal-3436613
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments