I have recently been re-coding a Contact Form. It currently (and previously) has a CAPTCHA that I designed myself which has so far been 100% watertight, while at the same time is way more user friendly than the usual wonky letters type… IF you can see! It is a visual question, so if you can’t see, you are stumped.
So I thought I may add an audio alternative option, but I’m not sure how to make it work and be nicely accessible.
What I wanted was a little audio icon in a link which when active would play the audio clip.
I have it working for mouse clicks, but if tabbing through the form and hitting “Enter” on focus it does not play.
<p><label for="num">How many fingers am I holding up?</label>
<input type="text" name="num" id="num" maxlength="2" size="2" value="" required tabindex="2">
<a>
<img class="icon" onclick="infFin()" src="images/info.svg" alt="Info" title="Field Information" width="20" height="20">
</a>
<span class="iaud">
<audio src="docs/qu-<?php echo $randnum ; ?>.wav" id="audio"><p>No Audio Plugin!</p></audio>
<a onclick="document.getElementById('audio').play()" title="If you cannot see the image use this audio question to get the required pass number." tabindex="3">
<img class="icon" src="images/audio.svg" alt="Audio Icon" width="30" height="30">
</a>
</span>
</p>
I know I’m using onclick
which works only with a mouse click, so what should I use?
Or am I doing this all wrong? I admit that the whole accessibility thing is a mystery to me, that’s why I’m asking, it’s something I need to improve on.