From 1d1b8964b9b6dbbc34c74ce574b741447951644e Mon Sep 17 00:00:00 2001 From: philg-dev <6079229+philg-dev@users.noreply.github.com> Date: Thu, 27 Mar 2025 18:26:40 +0100 Subject: [PATCH] Fixes Scroll instantly to next result in Find mode #4661 Navigating between search results in find mode now respects the Vimium setting "Use smooth scrolling". --- content_scripts/mode_find.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content_scripts/mode_find.js b/content_scripts/mode_find.js index e7c182497..95942b4be 100644 --- a/content_scripts/mode_find.js +++ b/content_scripts/mode_find.js @@ -475,9 +475,10 @@ const highlight = (textNode, startIndex, length) => { const rect = range.getBoundingClientRect(); if (rect.top < 0 || rect.bottom > globalThis.innerHeight) { const screenHeight = globalThis.innerHeight; + const scrollBehavior = Settings.get("smoothScroll") ? "smooth" : "instant"; globalThis.scrollTo({ top: globalThis.scrollY + rect.top + rect.height / 2 - screenHeight / 2, - behavior: "smooth", + behavior: scrollBehavior, }); }