jQuery(document).ready(function( $ ){ //Add landmark roles $('.elementor-location-header').attr('role', 'banner'); $('.elementor-location-footer').attr('role', 'contentinfo'); $('div[data-elementor-type=wp-page], div[data-elementor-type=wp-post], div[data-elementor-type=archive], div[data-elementor-type=single-post], div[data-elementor-type=error-404], div.pass-protected').attr('role', 'main').attr('id', 'main-content').attr('tabindex','-1'); $("#skiplink").click(function() { $('#main-content').focus(); }); // close mega menu when tabbing through a flyout and out onto the top level nav items jQuery(function($) { $('.mega-sub-menu').on('focusout', function(e) { e.preventDefault(); if (!$(this).has(event.relatedTarget).length && !$(this).is(event.relatedTarget)) { // Focus has moved outside the menu, so close it $('.max-mega-menu').data('maxmegamenu').hideAllPanels(); } }); }); // make svg invisible to SR $('.elementor-icon-list-icon svg, svg.e-font-icon-svg').attr('role','presentation').attr('tabindex','-1'); // Add aria-labels to roles $('.utility nav').attr('aria-label', 'Utility'); $('.mainNav nav').attr('aria-label', 'Global'); $('.footer nav').attr('aria-label', 'Footer'); // Add title text for Read More links for posts $('.news .jet-listing-grid__item').each(function () { var title = $('.title .elementor-heading-title a', this).html(); var viewDetails = $('.link a', this); $(viewDetails).append(' about ' +title+ ''); }); // Add title text for Read More links $('.hidden-text .elementor-column').each(function () { var title = $('.title .elementor-heading-title', this).html(); var viewDetails = $('.link a', this); $(viewDetails).append(' for ' +title+ ''); }); // Remove role Button $('.elementor-button-link').removeAttr('role', 'button'); // Announcer //Move Banner Top to below skip link in the DOM var banner = $(".ancr-group.ancr-pos-top") $(banner).insertAfter('.elementor-location-header #skiplink'); //Move bottom Banners to footer in the DOM var bannerBottom = $(".ancr-group.ancr-pos-bottom") $("div[data-elementor-type=footer]").prepend(bannerBottom); //Move Banner close button in the DOM $('.ancr-wrap').each(function() { var $this = $(this), $closeBtn = $this.find('.ancr-close-btn'), $target = $this.find('.ancr-content'); $target.append($closeBtn); }); // Accordion accessibility (New) $('div.e-n-accordion').removeAttr('aria-label'); $('details div').removeAttr('role').removeAttr('aria-labelledby'); $('details summary').removeAttr('tabindex'); // Add id and for to News/Blog Search $(".search .jet-filter-label").replaceWith(function(){ $(this).attr('for', 'search'); return this.outerHTML.replace(" 767) return; setTimeout(function () { let tabsElems = document.querySelectorAll('.e-n-tabs') tabsElems.forEach(e => { let activeTitles = e.querySelectorAll('.e-n-tab-title[aria-selected="true"]'); let activeContent = e.querySelector('.e-con.e-active') activeContent.style.display = 'none'; activeContent.classList.remove('e-active'); activeTitles.forEach(activeTitle => activeTitle.setAttribute('aria-selected', false)); activeTitles.forEach(activeTitle => activeTitle.setAttribute('tabindex', -1)); }); }, 300); }); /* Code from https://element.how/elementor-tabs-closed-by-default/ * Copyright 2024 Element.How * Make the Elementor tabs closable */ (function () { if (window.innerWidth > 767) return; let isOnPageLoad = true; window.addEventListener('load', () => { setTimeout(() => { isOnPageLoad = false; }, 600); }); if (document.querySelector('.elementor-editor-active')) return; document.querySelectorAll('.e-n-tab-title').forEach(tabTitle => { tabTitle.addEventListener('click', function () { if (isOnPageLoad) return; if (this.getAttribute('aria-selected') === 'true') { setTimeout(() => { const tabId = this.getAttribute('aria-controls'); const tabContent = document.getElementById(tabId); if (tabContent) { tabContent.style.display = 'none'; tabContent.classList.remove('e-active'); } this.setAttribute('aria-selected', 'false'); }, 30); } }); }); }()); /* Control the Elementor Tabs from the URL * Code from https://element.how/elementor-open-specific-tab-toggle-accordion/ * Copyright 2023 Element.how * Updated 2023/12/05 */ window.addEventListener('load', () => { setTimeout(function () { let scrollOffset = 200; /* scroll offset from the top of title */ const tabsAccordionToggleTitles = document.querySelectorAll('.e-n-accordion-item-title, .e-n-tab-title, .elementor-tab-title'); const clickTitleWithAnchor = (anchor) => { tabsAccordionToggleTitles.forEach(title => { if (title.querySelector(`#${anchor}`) != null || title.id === anchor || (title.closest('details') && title.closest('details').id === anchor)) { if (title.getAttribute('aria-expanded') !== 'true' && !title.classList.contains('elementor-active')) title.click(); let timing = 0; let scrollTarget = title; if (getComputedStyle(title.closest('.elementor-element')).getPropertyValue('--n-tabs-direction') == 'row') scrollTarget = title.closest('.elementor-element'); if (title.closest('.e-n-accordion, .elementor-accordion-item, .elementor-toggle-item')) { timing = 400; } setTimeout(function () { jQuery('html, body').animate({ scrollTop: jQuery(scrollTarget).offset().top - scrollOffset, }, 'slow'); }, timing); } }); }; document.addEventListener('click', (event) => { if (event.target.closest('a') && event.target.closest('a').href.includes('#')) { const anchor = extractAnchor(event.target.closest('a').href); if (anchor && isAnchorInTitles(anchor, tabsAccordionToggleTitles)) { event.preventDefault(); clickTitleWithAnchor(anchor); } } }); const currentAnchor = extractAnchor(window.location.href); if (currentAnchor) { clickTitleWithAnchor(currentAnchor); } function extractAnchor(url) { const match = url.match(/#([^?]+)/); return match ? match[1] : null; }; function isAnchorInTitles(anchor, titles) { return Array.from(titles).some(title => { return title.querySelector(`#${anchor}`) !== null || title.id === anchor || (title.closest('details') && title.closest('details').id === anchor); }); }; }, 300); });