Skip to content

Commit

Permalink
A11Y > fix focus move on click on Allow in site
Browse files Browse the repository at this point in the history
  • Loading branch information
nicozerr committed Oct 4, 2023
1 parent 4be35a6 commit 1ff5dad
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tarteaucitron.js
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,15 @@ var tarteaucitron = {
});
}

// accessibility: on click on "Allow" in the site (not in TAC module), move focus to the loaded service's parent
var allowBtnsInSite = document.querySelectorAll(".tarteaucitronAllow:not(#tarteaucitronRoot .tarteaucitronAllow)");
for (i = 0; i < allowBtnsInSite.length; i++) {
tarteaucitron.addClickEventToElement(allowBtnsInSite[i], function () {
this.closest('.tac_activate').parentNode.setAttribute("tabindex","-1");
this.closest('.tac_activate').parentNode.focus();
});
}

var allowBtns = document.getElementsByClassName("tarteaucitronAllow");
for (i = 0; i < allowBtns.length; i++) {
tarteaucitron.addClickEventToElement(allowBtns[i], function () {
Expand Down

0 comments on commit 1ff5dad

Please sign in to comment.