|
Lines 50-57
Link Here
|
| 50 |
if ( |
50 |
if ( |
| 51 |
$(window).scrollTop() >= |
51 |
$(window).scrollTop() >= |
| 52 |
wrapper.offset().top + |
52 |
wrapper.offset().top + |
| 53 |
wrapper.outerHeight() - |
53 |
wrapper.outerHeight() - |
| 54 |
window.innerHeight |
54 |
window.innerHeight |
| 55 |
) { |
55 |
) { |
| 56 |
consentBar.css("bottom", height); |
56 |
consentBar.css("bottom", height); |
| 57 |
} else { |
57 |
} else { |
|
Lines 71-82
Link Here
|
| 71 |
const consentBar = $("#cookieConsentBar"); |
71 |
const consentBar = $("#cookieConsentBar"); |
| 72 |
consentBar.attr("aria-hidden", "false"); |
72 |
consentBar.attr("aria-hidden", "false"); |
| 73 |
consentBar.css("display", "flex"); |
73 |
consentBar.css("display", "flex"); |
|
|
74 |
|
| 75 |
// Set focus to the first focusable element within the consent bar |
| 76 |
const firstFocusableElement = consentBar.find('a, button, input, select, textarea').filter(':visible').first(); |
| 77 |
if (firstFocusableElement.length) { |
| 78 |
firstFocusableElement.focus(); |
| 79 |
} else { |
| 80 |
// If no focusable elements exist, add tabindex to the bar itself to make it focusable |
| 81 |
consentBar.attr('tabindex', '-1').focus(); |
| 82 |
} |
| 74 |
} |
83 |
} |
| 75 |
|
84 |
|
| 76 |
function hideConsentBar() { |
85 |
function hideConsentBar() { |
| 77 |
const consentBar = $("#cookieConsentBar"); |
86 |
const consentBar = $("#cookieConsentBar"); |
| 78 |
consentBar.attr("aria-hidden", "true"); |
87 |
consentBar.attr("aria-hidden", "true"); |
| 79 |
consentBar.hide(); |
88 |
consentBar.hide(); |
|
|
89 |
|
| 90 |
// Remove focus from any currently focused element |
| 91 |
if (document.activeElement) { |
| 92 |
document.activeElement.blur(); |
| 93 |
} |
| 94 |
|
| 95 |
// Set focus to the body, which effectively removes visible focus indicators |
| 96 |
// This allows the first Tab press to highlight the "Skip to main content" link |
| 97 |
document.body.focus(); |
| 98 |
document.querySelector('body').setAttribute('tabindex', '-1'); |
| 99 |
document.querySelector('body').focus(); |
| 100 |
document.querySelector('body').removeAttribute('tabindex'); |
| 80 |
} |
101 |
} |
| 81 |
|
102 |
|
| 82 |
// Hides the appropriate consent container, depending on what |
103 |
// Hides the appropriate consent container, depending on what |
|
Lines 226-231
Link Here
|
| 226 |
$(".consentCheckbox").on("click", function () { |
247 |
$(".consentCheckbox").on("click", function () { |
| 227 |
maintainSelected(); |
248 |
maintainSelected(); |
| 228 |
}); |
249 |
}); |
|
|
250 |
|
| 229 |
} |
251 |
} |
| 230 |
|
252 |
|
| 231 |
// On page load, run any code that has been given consent |
253 |
// On page load, run any code that has been given consent |
| 232 |
- |
|
|