mirror of
https://github.com/bendtherules/UiQuestions.git
synced 2026-08-18 13:52:50 +00:00
Accordion - Change scrollRestoration delay to 1sec
This commit is contained in:
@@ -28,9 +28,13 @@ 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({ block: "center" });
|
targetElement.scrollIntoView({ block: "center" });
|
||||||
|
// Increased for mobile browsers
|
||||||
|
const scrollRestorationDelay = 1000; // 1s
|
||||||
|
setTimeout(() => {
|
||||||
if ("scrollRestoration" in history) {
|
if ("scrollRestoration" in history) {
|
||||||
history.scrollRestoration = "auto";
|
history.scrollRestoration = "auto";
|
||||||
}
|
}
|
||||||
|
}, scrollRestorationDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user