From c3ac7b41ddbed0f1e721542ee19228ce0a46f645 Mon Sep 17 00:00:00 2001 From: Roman Grinovski Date: Tue, 19 Sep 2023 23:06:37 +0200 Subject: [PATCH] make scrollIntoView more smooth --- src/components/Accordion/Item.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Accordion/Item.tsx b/src/components/Accordion/Item.tsx index f18eeae2..1d478382 100644 --- a/src/components/Accordion/Item.tsx +++ b/src/components/Accordion/Item.tsx @@ -59,7 +59,10 @@ const AccordionItem = ({ if (!detailsRef.current.hasAttribute("open")) { // Push to end of queue to read updated position and scroll to it setTimeout(() => { - detailsRef.current.scrollIntoView({ behavior: "smooth" }); + detailsRef.current.scrollIntoView({ + behavior: "smooth", + block: "nearest", + }); }); }