Close navigation if the user tabs out of navigation links
This commit is contained in:
parent
a7c2bf8f29
commit
85ef8b87b3
|
@ -118,4 +118,13 @@
|
||||||
closeNavigation();
|
closeNavigation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleBlur = () => {
|
||||||
|
const navList = event.currentTarget.closest(".navbar__links");
|
||||||
|
if (!event.relatedTarget || !navList.contains(event.relatedTarget)) {
|
||||||
|
closeNavigation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
navbarLinkItems[navbarLinkItems.length - 1].addEventListener("blur", handleBlur);
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue