[]
Recipes | American Heart Association Recipes American Heart Association
li’); let uiReport = document.querySelector(‘.rw-ui-report’); let uiInfoContainer = document.querySelector(‘.rw-ui-info-container’); let activeItemBeforeOpenPopup = null; // Add tabindex to all stars if(allStars.length > 0) { for (let i = 0; i -1; let observer = new MutationObserver(observerCallback); let observerOptions = { attributeFilter: [‘style’] }; uiReport.id = ‘rw-ui-report’; // Add to prevent IE and Edge from throwing JavaScript errors, Firefox doesn’t like this if(!isFirefox) { observerOptions.attributes = true; } // Only report changes to style attribute on UI Report popup observer.observe(uiReport, observerOptions); } if(uiInfoContainer) { uiInfoContainer.setAttribute(‘tabindex’, 0); uiInfoContainer.setAttribute(‘aria-describedby’, ‘rw-ui-report’); uiInfoContainer.addEventListener(‘keyup’, function(e) { if((e.keyCode === 32 || e.keyCode === 13)) { activeItemBeforeOpenPopup = document.activeElement; uiInfoContainer.onmouseover(); } }); } function observerCallback(mutationList) { let index = mutationList.length – 1; let closeButton = document.querySelector(‘.rw-ui-close’); let popupHeading = document.querySelector(‘.rw-ui-report-header’); if(closeButton) { closeButton.setAttribute(‘tabindex’, 0); closeButton.setAttribute(‘aria-label’, ‘Close.’); } if(popupHeading) { popupHeading.setAttribute(‘tabindex’, 0); } let focusableElements = document.querySelectorAll(‘.rw-ui-report a[href], .rw-ui-report area[href], .rw-ui-report input:not([disabled]):not([type=”hidden”]), .rw-ui-report select:not([disabled]), .rw-ui-report textarea:not([disabled]), .rw-ui-report button:not([disabled]), .rw-ui-report iframe, .rw-ui-report object, .rw-ui-report embed, .rw-ui-report [tabindex=”0″], .rw-ui-report [contenteditable], .rw-ui-report audio[controls], .rw-ui-report video[controls], .rw-ui-report summary, .rw-ui-report [tabindex^=”0″], .rw-ui-report [tabindex^=”1″], .rw-ui-report [tabindex^=”2″], .rw-ui-report [tabindex^=”3″], .rw-ui-report [tabindex^=”4″], .rw-ui-report [tabindex^=”5″], .rw-ui-report [tabindex^=”6″], .rw-ui-report [tabindex^=”7″], .rw-ui-report [tabindex^=”8″], .rw-ui-report [tabindex^=”9″]’); // Add click on close button when it’s keyboard selected. Add tab capture inside UI popup if(mutationList[index].target.style.display === ‘block’) { popupHeading.focus(); document.addEventListener(‘keydown’, escapeCloseReportPopup); closeButton.addEventListener(‘keyup’, function(e) { if((e.keyCode === 32 || e.keyCode === 13) && e.target.tagName === ‘SPAN’) { closeReportPopup(); } }); focusableElements[focusableElements.length – 1].addEventListener(‘keydown’, function(e) { if(e.keyCode === 9) { e.preventDefault(); focusableElements[0].focus(); } if(e.shiftKey && e.keyCode == 9) { e.preventDefault(); focusableElements[focusableElements.length – 2].focus(); } }); focusableElements[0].addEventListener(‘keydown’, function(e) { if(e.shiftKey && e.keyCode == 9) { e.preventDefault(); focusableElements[focusableElements.length – 1].focus(); } }); } if(mutationList[index].target.style.display === ‘none’) { document.removeEventListener(‘keydown’, escapeCloseReportPopup); } function closeReportPopup() { closeButton.click(); if(activeItemBeforeOpenPopup) { activeItemBeforeOpenPopup.focus(); } } function escapeCloseReportPopup(e) { if(e.keyCode === 27) { closeReportPopup(); } } } }); }; // Append Rating-Widget JavaScript library. var rw, s = d.getElementsByTagName(e)[0], id = “rw-js”, l = d.location, ck = “Y” + t.getFullYear() + “M” + t.getMonth() + “D” + t.getDate(), p = l.protocol, f = ((l.search.indexOf(“DBG=”) > -1) ? “” : “.min”), a = (“https:” == p ? “secure.” + m + “js/” : “js.” + m); if (d.getElementById(id)) return; rw = d.createElement(e); rw.id = id; rw.async = true; rw.type = “text/javascript”; rw.src = p + “//” + a + “external” + f + “.js?ck=” + ck; s.parentNode.insertBefore(rw, s); }(document, new Date(), “script”, “rating-widget.com/”));]]>