Skip to content

Commit

Permalink
make scrollIntoView more smooth
Browse files Browse the repository at this point in the history
  • Loading branch information
Roma36 committed Sep 19, 2023
1 parent 0eae17d commit c3ac7b4
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 c3ac7b4

Please sign in to comment.