imagify-plugin icon indicating copy to clipboard operation
imagify-plugin copied to clipboard

`img` element inside `picture` tag does not include `alt` attribute

Open boogah opened this issue 1 year ago • 0 comments
trafficstars

Before submitting an issue please check that you’ve completed the following steps:

  • [x] Made sure you’re on the latest version
  • [x] Used the search feature to ensure that the bug hasn’t been reported before

Describe the bug When using picture tags to display next-gen images, I've noticed that the img element does not include an alt attribute, even when alt text is set for the image in the Media Library.

To Reproduce Steps to reproduce the behavior:

  1. In "Settings -> Imagify", pick a next-gen image format and check "Display images in Next-Gen format on the site".
  2. Select the "Use <picture> tags (preferred)" option and click Save Changes.
  3. Navigate to a page on the front end of the site and view source.
  4. Notice the img element inside the picture tag does not include an alt attribute. Not even a blank one.

Expected behavior If I or another user has bothered to set alt text for an image, it should be displayed in the site's HTML.

Additional context This is making the site less accessible to screen reader users as well as fail accessibility checks.

Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming

boogah avatar Oct 02 '24 19:10 boogah