From 1a30872c63aabb50aaa296cfa631572db5dfc9c5 Mon Sep 17 00:00:00 2001 From: Valerie Young Date: Fri, 4 Dec 2020 13:32:42 -0800 Subject: [PATCH] Do not expect 'include optional support' in example --- examples/disclosure/js/disclosureMenu.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/disclosure/js/disclosureMenu.js b/examples/disclosure/js/disclosureMenu.js index 106b75a318..d39f368f64 100644 --- a/examples/disclosure/js/disclosureMenu.js +++ b/examples/disclosure/js/disclosureMenu.js @@ -201,6 +201,21 @@ window.addEventListener( }); } + // fake link behavior + var links = document.querySelectorAll('[href="#mythical-page-content"]'); + var examplePageHeading = document.getElementById('mythical-page-heading'); + for (var k = 0; k < links.length; k++) { + links[k].addEventListener('click', function (event) { + var pageTitle = event.target.innerText; + examplePageHeading.innerText = pageTitle; + + // handle aria-current + for (var n = 0; n < links.length; n++) { + links[n].removeAttribute('aria-current'); + } + }); + } + // fake link behavior disclosureMenus.forEach((disclosureNav, i) => { var links = menus[i].querySelectorAll('[href="#mythical-page-content"]');