Created
May 12, 2021 14:57
-
-
Save RJGrunau/6c02b25df0fbd5d316a07a0862258cc2 to your computer and use it in GitHub Desktop.
Handling VoiceOver focus on an iOS device while using safari
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setVoiceOverFocus(element) { | |
var focusInterval = 10; // ms, time between function calls | |
var focusTotalRepetitions = 10; // number of repetitions | |
element.setAttribute('tabindex', '0'); | |
element.blur(); | |
var focusRepetitions = 0; | |
var interval = window.setInterval(function() { | |
element.focus(); | |
focusRepetitions++; | |
if (focusRepetitions >= focusTotalRepetitions) { | |
window.clearInterval(interval); | |
} | |
}, focusInterval); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment