wp-media / imagify-plugin

Speed up your website with lighter images without losing quality.
https://imagify.io
73 stars 26 forks source link

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

Open boogah opened 1 month ago

boogah commented 1 month ago

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

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