Accordion - restore scrollRestoration to "auto" after scroll

This commit is contained in:
2020-10-26 12:32:20 +05:30
parent 79569dac8c
commit 686a3e49e4
+3
View File
@@ -28,6 +28,9 @@ const Accordion = ({ children, title = "More" }) => {
// 4. and scroll into view and focus // 4. and scroll into view and focus
targetElement.focus(); targetElement.focus();
targetElement.scrollIntoView({ behavior: "smooth", block: "center" }); targetElement.scrollIntoView({ behavior: "smooth", block: "center" });
if ("scrollRestoration" in history) {
history.scrollRestoration = "auto";
}
} }
} }