Add missing aria label for campaign close button (#12489)

This commit is contained in:
Andrea Martz 2021-01-29 16:51:18 -06:00 committed by GitHub
parent 8e7cd6a699
commit 0c0e28dd35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,10 +3,12 @@
function initializeHeroBannerClose() {
let bannerWrapper = document.getElementById('hero-html-wrapper');
let closeIcon = document.getElementById('js-hero-banner__x');
// Currently js-hero-banner__x button icon ID needs to be written into the abstract html
// In the future this could be extracted so the implementer doesn't need to worry about it.
if (bannerWrapper && closeIcon) {
closeIcon.setAttribute('aria-label', 'Close campaign banner');
closeIcon.addEventListener('click', () => {
localStorage.setItem('exited_hero', bannerWrapper.dataset.name);
bannerWrapper.style.display = 'none';