Skip to content

Commit

Permalink
fix event target in menu.js (#44019)
Browse files Browse the repository at this point in the history
  • Loading branch information
SniperSister authored Sep 23, 2024
1 parent e4e6e8b commit 6043567
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions build/media_source/mod_menu/js/menu.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,32 @@
spanEl.addEventListener('mouseout', topLevelMouseOut(topLevelEl, settings));
}

topLevelEl.addEventListener('mouseover', ({ target }) => {
const ulChild = target.querySelector('ul');
topLevelEl.addEventListener('mouseover', ({ currentTarget }) => {
const ulChild = currentTarget.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'false');
ulChild.classList.add(settings.menuHoverClass);
}
});

topLevelEl.addEventListener('mouseout', ({ target }) => {
const ulChild = target.querySelector('ul');
topLevelEl.addEventListener('mouseout', ({ currentTarget }) => {
const ulChild = currentTarget.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'true');
ulChild.classList.remove(settings.menuHoverClass);
}
});

topLevelEl.addEventListener('focus', ({ target }) => {
const ulChild = target.querySelector('ul');
topLevelEl.addEventListener('focus', ({ currentTarget }) => {
const ulChild = currentTarget.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'true');
ulChild.classList.add(settings.menuHoverClass);
}
});

topLevelEl.addEventListener('blur', ({ target }) => {
const ulChild = target.querySelector('ul');
topLevelEl.addEventListener('blur', ({ currentTarget }) => {
const ulChild = currentTarget.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'false');
ulChild.classList.remove(settings.menuHoverClass);
Expand Down

0 comments on commit 6043567

Please sign in to comment.