Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.
https://shopify.github.io/liquid/
MIT License
11.15k stars 1.4k forks source link

video_tag fallback image missing alt attribute #1720

Open bigskillet opened 1 year ago

bigskillet commented 1 year ago

video_tag fallback image missing alt attribute and triggering Lighthouse accessibility error: https://shopify.dev/docs/api/liquid/filters/video_tag

image

bigskillet commented 1 year ago

...and why is there an image tag inside the video tag anyways? It doesn't render on any browsers if the poster is empty. Is it necessary and/or semantic?

ryanm-bw commented 9 months ago

@Shopify could we please get this one actioned? It should be a simple change and is then consistent with img_tag, as well as complying with Lighthouse.

PreranaSunbowl commented 4 months ago

Can this be fixed pelase?

anthony-spain commented 3 months ago

Found this while doing an ADA audit today, still an ongoing issue.

mcvmel commented 3 months ago

Ran into this as well recently. This may depend on your theme, but after uploading the video in the theme customizer, you can click on the video thumbnail and a black overlay will appear. In that screen there is a space for alt text. This fixed my issue.

andrewhawkes commented 2 months ago

This is still an issue. Ideally is should be possible to pass an empty alt value or custom.

0x15f commented 1 month ago

+1

In Lighthouse 12.2.0 when the video is below the fold the <img /> gets flagged as an eagerly loaded offscreen image. It also lacks an alt. The video spec mentions nothing on the inclusion of an <img /> inside of <video />

The spec for video poster in Liquid either needs to be fixed or expanded to allow us to:

This is not the way 👇

{% capture video_elem %}
  {{ video | video_tag: playsinline: '', muted: '', loop: '' }}
{% endcapture %}

{% if section.index < 2 %}
  {% comment %} make poster lazy {% endcomment %}
  {% assign video_elem = video_elem | replace: '<img', '<img loading="lazy"'  %}
{% endif %}

{{ video_elem }}