Provide media search on alternative text

Created on 27 March 2024, 3 months ago
Updated 28 March 2024, 3 months ago

Problem/Motivation

Currently, the media library can only be searched by file name. This assumes that media creators use meaningful file names when creating images or other media. In real life that is often not the case. I regularly see file names like 1.3.1.png, 13867453.jpg or 1254175589_3c4a4466d4_b.jpg, which website editors are unlikely to know to be able to search on.

It would be useful to also be able to search the alternative text, which will typically include meaningful search terms.

Steps to reproduce

  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 Content
  18. Click Add content
  19. Click Basic page
  20. Click in the body WYSIWYG
  21. Click the media icon
  22. Click Choose files
  23. Navigate to a file that has a meaningless file name and click Upload
  24. Type alternative text for the image
  25. Click save
  26. Repeat this activity for an additional 100 images (I don't expect you to actually do this, but consider it closer to a real life situation)
  27. Now imagine trying to find one of those 100 images by just the meaningless file name using the Name search field
  28. Try to find one of those 100 images by the alternative text

Desired result: There is an alternative text field that you can use to put in one or more words that are meaningful that can be searched against the alternative text of those 100 images

Actual result: There is no way to search on alternative text. Attempting to use meaningful words to search meaningless file names does not provide useful results.

Proposed resolution

Option one: Provide a unified search field that searches both name and alternative text.
Option two: Provide an additional search field that searches alternative text.

Remaining tasks

User interface changes

Option one: Replace the Name label with a label reading "Name or Alternative text"
Option two: Add a field with a label "Alternative text"

API changes

Data model changes

Release notes snippet

โœจ Feature request
Status

Active

Version

11.0 ๐Ÿ”ฅ

Component
Mediaย  โ†’

Last updated about 3 hours ago

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States Charles Belov San Francisco, CA, US

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

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

  • Issue created by @Charles Belov
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen

    Am I mistaken or isnโ€™t that a View? I think itโ€™s a few clicks to add that alt text exposed filter.

    Understandably this could be a new default. Iโ€™m just saying this probably isnโ€™t much of a change.

Production build 0.69.0 2024