Skip to content

Commit

Permalink
make scrollIntoView more smooth (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roma36 authored Sep 20, 2023
1 parent 0eae17d commit 15684e9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Accordion/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
});
}

Expand Down

0 comments on commit 15684e9

Please sign in to comment.