From e8294fab75175c31d08bf45c53838032554b0f41 Mon Sep 17 00:00:00 2001 From: Ionut-Cristian Florescu Date: Tue, 5 Mar 2024 19:06:01 +0200 Subject: [PATCH] Improve scroll example again --- .../scrolling-a-row-into-view/ScrollRowIntoViewExamples.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/examples/scrolling-a-row-into-view/ScrollRowIntoViewExamples.tsx b/app/examples/scrolling-a-row-into-view/ScrollRowIntoViewExamples.tsx index e7c95ec00..b0852b3b2 100644 --- a/app/examples/scrolling-a-row-into-view/ScrollRowIntoViewExamples.tsx +++ b/app/examples/scrolling-a-row-into-view/ScrollRowIntoViewExamples.tsx @@ -8,7 +8,9 @@ import { employees } from '~/data'; export function ScrollIntoViewExample() { // example-start scroll-into-view const scrollRowIntoView = (selector: string) => { - document.querySelector(selector)?.scrollIntoView(false); + document.querySelector(selector)?.scrollIntoView({ block: 'end', behavior: 'smooth' }); + // 👇 if you don't want smooth scrolling, you could simply use this instead: + // document.querySelector(selector)?.scrollIntoView(false); }; return (