svelte
svelte copied to clipboard
Disabling video caption warning when aria-label=hidden
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
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?
This should be fixed in 3.56.0.