From 1a1e82e15ec25f55ef49740a6b9aada5ba98aeb3 Mon Sep 17 00:00:00 2001 From: Kalabasa Date: Sat, 24 Feb 2024 20:07:08 +1100 Subject: [PATCH] Explain setTimeout --- htmz.dev.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htmz.dev.html b/htmz.dev.html index 93fe47b..9d84abd 100644 --- a/htmz.dev.html +++ b/htmz.dev.html @@ -2,7 +2,9 @@ function htmz(frame) { // Write your extensions here - // Remove setTimeout to let the browser autoscroll content changes into view + // The browser automatically scrolls DOM changes into view in response to user interaction. + // This delay prevents that, making this is the only case where we don't lean on browser defaults. + // Remove setTimeout wrapper to allow automatic scrolling. setTimeout(() => document .querySelector(frame.contentWindow.location.hash || null) @@ -10,4 +12,4 @@ ); } - +