diff --git a/docs/assets/scripts/scroll.js b/docs/assets/scripts/scroll.js index e0c4c27e0..8a2bbe113 100644 --- a/docs/assets/scripts/scroll.js +++ b/docs/assets/scripts/scroll.js @@ -1,13 +1,14 @@ // Smooth links document.addEventListener('click', event => { const link = event.target.closest('a'); - const id = (link?.hash ?? '').substr(1); - if (!link || link.getAttribute('data-smooth-link') === 'off') { return; } - if (id) { + const id = (link.hash ?? '').substr(1); + + // Only handle smooth scroll if there's a hash and the link points to the current page + if (id && link.pathname === window.location.pathname) { const target = document.getElementById(id); const headerHeight = document.querySelector('wa-page > header').clientHeight;