svelte icon indicating copy to clipboard operation
svelte copied to clipboard

Disabling video caption warning when aria-label=hidden

Open Lootwig opened this issue 1 year ago • 1 comments

Describe the problem

Embedding a <video aria-hidden="true"> element in a page, without adding a captions <track> yields the following warning:

A11y: <video> elements must have a <track kind="captions">

Describe the proposed solution

With the aria tag marking the video as hidden (playing for decorative reasons in the background without sound), the warning doesn't make sense and should be suppressed

Alternatives considered

Manually adding a comment <!-- svelte-ignore a11y-media-has-caption -->

Importance

nice to have

Lootwig avatar Sep 17 '22 16:09 Lootwig

I think that when the aria-hidden="true" attribute is present on a <video> tag, it doesn't necessarily mean that the content of that video can't be described, even if it is for presentational purposes only.

However, the <track kind="descriptions"> attribute is what should be used instead, but the svelte compiler doesn't account for that case, so the A11y: <video> elements must have a <track kind="captions"> doesn't make sense either.

It might be nice to have instead an A11y: hidden <video> elements must have a <track kind="descriptions"> warning in the future when a <video> tag has aria-hidden="true" and there's no <track kind="descriptions"> inside, maybe?

buhodev avatar Sep 19 '22 04:09 buhodev

This should be fixed in 3.56.0.

Conduitry avatar Mar 10 '23 00:03 Conduitry