klaro-js
klaro-js copied to clipboard
Fixed an issue with Klaro autofocus
Klaro loses its autofocus when the main page, into which Klaro has been loaded, focuses on one of its own elements. Accepting or rejecting cookie consent should be first thing on focus (if the autofocus is set to true in config). This is an accessibility issue for keyboard navigation.
To test this issue in action:
- Set
autofocustotruein config.js located inklaro-js/dist/config.js - In the
simple.htmllocated inklaro-js/dist/examples/simple.html, add an input element in the body with an id, for example<input id="autofocus-test"></input>, then create a new script tag like so<script>document.getElementById("autofocus-test").focus()</script> - Opening the example page
simple.htmlwill result the focus going to the input box instead of klaro's cookie notice.