@@ -1,5 +1,6 @@
1import Section from "./Section";
1import Section from "./Section";
2−import { useState, useEffect } from "react";
2+import { useState, useEffect, useRef } from "react";
3+import { useRouter } from "next/router";
3import { TableOfContents } from "./TableOfContents";
4import { TableOfContents } from "./TableOfContents";
5export default function ContentArea(props) {
6export default function ContentArea(props) {
@@ -20,9 +21,31 @@ export default function ContentArea(props) {
20 setShortcut(detectOS());
21 setShortcut(detectOS());
24+ const scrollBox = useRef();
26+ const router = useRouter();
29+ const handleRouteChange = () => {
30+ if (scrollBox.current === null) return;
31+ scrollBox.current.scrollTop = 0;
34+ router.events.on("routeChangeComplete", handleRouteChange);
36+ // If the component is unmounted, unsubscribe
37+ // from the event with the `off` method:
39+ router.events.off("routeChangeStart", handleRouteChange);
24 <div className="w-full min-w-0 flex flex-col items-center">
44 <div className="w-full min-w-0 flex flex-col items-center">
25− <div className="px-4 md:px-12 lg:px-24 pb-24 pt-8 md:pt-10 lg:pt-16 flex flex-col w-full max-w-screen-xl max-h-screen h-screen overflow-y-scroll">
47+ className="px-4 md:px-12 lg:px-24 pb-24 pt-8 md:pt-10 lg:pt-16 flex flex-col w-full max-w-screen-xl max-h-screen h-screen overflow-y-scroll"
26 <div className="flex justify-between w-full items-center flex-shrink-0">
49 <div className="flex justify-between w-full items-center flex-shrink-0">
27 <div className="type-ui text-gray">{props.breadcrumbs}</div>
50 <div className="type-ui text-gray">{props.breadcrumbs}</div>
28 <div className="hidden md:block">
51 <div className="hidden md:block">