mirror of
https://github.com/helenclx/leilukin-site.git
synced 2025-04-04 21:22:41 +00:00
Close navigation if the user tabs out of navigation links
This commit is contained in:
parent
a7c2bf8f29
commit
85ef8b87b3
@ -118,4 +118,13 @@
|
||||
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>
|
Loading…
x
Reference in New Issue
Block a user