5

I have several tooltips that surface an animation on hover. At first we used Gifs but our team decided to replace the gifs with .mp4 files. These are animations that show examples of how to use a given option. They have no sound.

But now I'm unable to find the proper way to add accessibility for screenreaders. Apparently you can't use alt text on video elements. title is not meant for accessibility. I understand there is a track element you're supposed to add for captions. But We don't want visible captions on these video animations. We just want alt text that explains that there's an animation showing an example of how to use the selected option.

Johannes
  • 64,305
  • 18
  • 73
  • 130
codemon
  • 1,456
  • 1
  • 14
  • 26

5 Answers5

2

There is, not yet, a proper way to do this natively. I've found this other post on SO about controlling <track> with CSS. So including but hiding it won't do the trick.

You could create a transcript of your animation and include it below the video, hidden or shown in view. Like this example does. Audio transcript example.

What you also could do is build your own tooltip. One which is shown when hovering the video and uses the WAI-ARIA role="tooltip" and aria-hidden attributes to show that its a tooltip and if it is visible. Inside these tooltips you can place whatever text you want about the video. Just make sure that the aria-hidden attribute is false when hovering and true when not.

<span role="tooltip" aria-hidden="false">Your tooltip content</span>

Check these examples on how to create accessible tooltips.

Emiel Zuurbier
  • 19,095
  • 3
  • 17
  • 32
2

video elements can't have the tooltip role so you should enclose the element in a div with this role. Then, as this role does require a name and has no accessible content, use aria-label with your accessible alternative:

<div role="tooltip" aria-label="Your accessible description goes here">
   <video />
</div>
Adam
  • 17,838
  • 32
  • 54
0

If you're set against using captions, you may want to consider the following options:

  1. Create a text document that tells the same story and presents the same information as the prerecorded video-only content
  2. Provide an audio track describing the information in the video

In either case, it would make sense that the alternative format (i.e. text or audio) would be placed near the video on the page.

Josh
  • 3,872
  • 1
  • 12
  • 13
0

You can use the longdesc attribute in the video tag, which contains an URL/link to a text file with a description of the animation.

Johannes
  • 64,305
  • 18
  • 73
  • 130
-2

Add captions, it isn't about what you want it is about what you users need / expect.

Non-impaired users will not see the captions anyway as they are off by default but can switch them on If They Want (if this isn't the case you need a different video player).

If you start with [SILENT VIDEO - captions explain steps] then your deaf users can switch off the instructions If They Want

Blind users will thank you for providing captions as they can then find out what the video contains (as this is an instructional video you may find that a separate set of instructions may work better to describe the steps in detail)

TL; DR - use captions in production - there is no reason not to use captions in a production environment, several reasons to use them.

EDIT / ADDITIONAL

If you really want to make sure your video has no subtitles by default the following JS will disable all of them by default.

for (var i = 0; i < video.textTracks.length; i++) {
   video.textTracks[i].mode = 'hidden';
}
GrahamTheDev
  • 22,724
  • 2
  • 32
  • 64
  • There are numerous circumstances where captions are not appropriate. – Slbox May 26 '20 at 19:19
  • A software demo. And when you state, "there is not reason not to use captions" - limited time is _always_ a reason. A good enough one? Maybe not, but a reason which you neglect. – Slbox May 26 '20 at 23:18
  • I am happy to change my answer to include "in production" to avoid confusion (which I have done) as you are correct, that is a valid time where captions are not needed. However that really is a stretch so I stand by my answer still (with that caveat), use captions, time is not an excuse that would hold up in court if you got sued for discrimination, so I don't want to muddy the water with that in my answer. – GrahamTheDev May 27 '20 at 05:36
  • You're right about the related laws in _some_ jurisdictions, but for all the people no in those jurisdictions and all hobbyists, the claim "there is no reason" is far too strong. – Slbox May 27 '20 at 22:47
  • Globally, at least 2.2 billion people have a vision impairment or blindness https://www.who.int/news-room/fact-sheets/detail/blindness-and-visual-impairment Around 466 million people worldwide have disabling hearing loss <---https://www.who.int/news-room/fact-sheets/detail/deafness-and-hearing-loss - So commercially around 25% of your customers would benefit from subtitles / captions. I will stand by the statement as the time it takes to add captions is so small compared to the commercial benefits, legal benefits and your moral obligation to include everyone. – GrahamTheDev May 28 '20 at 06:27