Skip to content

Commit

Permalink
hover effect on subnav item
Browse files Browse the repository at this point in the history
  • Loading branch information
webjsavella committed Dec 17, 2024
1 parent 4cb7309 commit c518363
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion eds/blocks/local-navigation/local-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
padding-inline: var(--space-6);
}

.local-navigation ul li a[aria-current='true']:hover {
.local-navigation ul li a[aria-current='true']:hover, .local-navigation ul li a:hover {
background-color: #2b2b2b;
}

Expand Down
9 changes: 4 additions & 5 deletions eds/blocks/local-navigation/local-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ function listenSubNav(subNavItems) {
});

document.addEventListener('click', (e) => {
let isClickInside = subNavItems.contains(e.target);

if (!isClickInside) { 
const isClickInside = subNavItems.contains(e.target);
if (!isClickInside) {
subNavItems.setAttribute('aria-expanded', 'false');
subNavItems.nextElementSibling.setAttribute('aria-hidden', 'true');
}
});
});
}

/**
Expand All @@ -77,7 +76,7 @@ function appendPageTitle(pgObj, block, i, menuTitle) {
aHref.innerHTML = `${pgObj.pageTitle}`;
aHref.setAttribute('aria-current', 'false');

if ((currPageTitle === pgObj.pageTitle.toLowerCase() || menuTitle === pgObj.pageTitle) && !pgObj.subnavItems) {
if ((currPageTitle === pgObj.pageTitle.toLowerCase() || menuTitle === pgObj.pageTitle)) {
aHref.setAttribute('aria-current', 'true');
}

Expand Down

0 comments on commit c518363

Please sign in to comment.