feat: more robust checking for exit link classes

This commit is contained in:
Iain Learmonth 2026-05-19 12:55:19 +01:00
parent 656d6e5dd2
commit f3698dc8a6

View file

@ -44,9 +44,9 @@
let target = e.target.closest("a"); let target = e.target.closest("a");
if (target) { if (target) {
// if the click was on or within an <a> // if the click was on or within an <a>
if (!target.className.includes("snap-skip-link") && if (!target.classList.contains("snap-skip-link") &&
!target.className.includes("snap-link--mirror") && !target.classList.contains("snap-link--mirror") &&
!target.className.includes("snap-link--snapshot")) { !target.classList.contains("snap-link--snapshot")) {
e.preventDefault(); e.preventDefault();
document.body.dataset.currentLink = target.href; document.body.dataset.currentLink = target.href;
} }