1

I have had an accessibility check done on my site and it found that the iframe surrounding the image created for reCaptcha has a title attribute, but no alt attribute. Is there a way to add one? This is needed for screen readers to identify the image.

I've tried going through Google's developer's site to see if there is any documentation about this or guides, and nothing addressed it. So it sent me to Stack Overflow.

Here is the code to add recaptcha, which I should have included with my original question:

<script src="google.com/recaptcha/…>
<script>
function onClick(e) {
    e.preventDefault();
    grecaptcha.ready(function() {
                grecaptcha.execute('reCAPTCHA_site_key', {
                        action: 'submit'
                    }).then(function(token) { // Add your logic to submit to your backend server here. }); }); }
</script>
5
  • Have you investigated if an aria-label attribute works? Commented Jun 10 at 15:42
  • That's not an option. Here is more information (that I probably should have had in my question). This is the code to add the recaptcha thingummy: Commented Jul 8 at 12:04
  • Here is the code to add recaptcha, which I should have included with my original question: <script src="google.com/recaptcha/…> <script> function onClick(e) { e.preventDefault(); grecaptcha.ready(function() { grecaptcha.execute('reCAPTCHA_site_key', {action: 'submit'}).then(function(token) { // Add your logic to submit to your backend server here. }); }); } </script> Commented Jul 8 at 12:07
  • Sorry, I'm new to this site and not used to the interface. Here is my real response: That's not an option. Google does all the lifting. In a comment below I added the code that creates the recaptcha. As you can see all the UI components are then added to the site by google. I am hoping someone knows something I can add to the script that will make it more accessible, or more specifically, make it pass accessibility testers. Commented Jul 8 at 12:13
  • (I edited the code into your question.) For the benefit of anyone writing an answer, do you have jQuery available, or do you need plain JavaScript only? The answers to ReCaptcha API v2 Styling seem to me to imply that you're not going to be able to do it (cross-origin policy). Commented Jul 8 at 15:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.