diff --git a/components/Layout/index.jsx b/components/Layout/index.jsx
index dfe472b..b8b91cc 100644
--- a/components/Layout/index.jsx
+++ b/components/Layout/index.jsx
@@ -7,6 +7,7 @@ import NavBar from '../Navigation';
import MetaBar from '../Metabar';
import SideBar from '../Sidebar';
import Footer from '../Footer';
+import { NavigationStateProvider } from '../../providers/navigationStateProvider';
/**
* @typedef {Object} Props
@@ -20,7 +21,7 @@ import Footer from '../Footer';
* @param {Props} props
*/
export default ({ metadata, headings, readingTime, children }) => (
- <>
+
@@ -40,5 +41,5 @@ export default ({ metadata, headings, readingTime, children }) => (
- >
+
);
diff --git a/components/Sidebar/index.jsx b/components/Sidebar/index.jsx
index 0d88837..32aff1e 100644
--- a/components/Sidebar/index.jsx
+++ b/components/Sidebar/index.jsx
@@ -1,5 +1,7 @@
import SideBar from '@node-core/ui-components/Containers/Sidebar';
import { sidebar } from '../../site.json' with { type: 'json' };
+import { useRef, useLayoutEffect } from 'react';
+import useScrollToElement from '../../hooks/useScrollToElement';
/** @param {string} url */
const redirect = url => (window.location.href = url);
@@ -9,12 +11,26 @@ const PrefetchLink = props => ;
/**
* Sidebar component for MDX documentation with page navigation
*/
-export default ({ metadata }) => (
-
-);
+export default ({ metadata }) => {
+ const sidebarRef = useRef(null);
+
+ // SideBar from @node-core/ui-components does not support forwardRef,
+ // so ref={sidebarRef} is silently ignored. useLayoutEffect runs before
+ // useEffect, so by the time useScroll's effect attaches the scroll
+ // listener, sidebarRef.current already points to the real