fix: don't scroll on fragment links in partials (#1906)

This commit is contained in:
Marvin Hagemeister
2023-10-11 10:30:31 +02:00
committed by GitHub
parent 36ea0385ed
commit a1f0d4a5bd
4 changed files with 211 additions and 115 deletions
+3 -1
View File
@@ -910,8 +910,10 @@ document.addEventListener("click", async (e) => {
) {
const partial = el.getAttribute(PARTIAL_ATTR);
// Check if the user opted out of client side navigation.
// Check if the user opted out of client side navigation or if
// we're doing a fragment navigation.
if (
el.getAttribute("href")?.startsWith("#") ||
!checkClientNavEnabled() ||
el.closest(`[${CLIENT_NAV_ATTR}="true"]`) === null
) {