Skip to content

Commit c23be9b

Browse files
committed
fixed scrolling on full page nav
1 parent 009596d commit c23be9b

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

app/root.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ let default = () => {
3838
<body>
3939
<Navigation isOverlayOpen setOverlayOpen />
4040
<Outlet />
41+
<ScrollRestoration />
4142
<Scripts />
4243
</body>
4344
</html>

src/bindings/ReactRouter.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ module Outlet = {
2626
external make: unit => React.element = "Outlet"
2727
}
2828

29+
module ScrollRestoration = {
30+
@module("react-router") @react.component
31+
external make: unit => React.element = "ScrollRestoration"
32+
}
33+
2934
module Meta = {
3035
@module("react-router") @react.component
3136
external make: unit => React.element = "Meta"
@@ -48,6 +53,7 @@ module Link = {
4853
~className: string=?,
4954
~target: string=?,
5055
~to: Path.t,
56+
~preventScrollReset: bool=?,
5157
) => React.element = "Link"
5258

5359
module Path = {
@@ -61,6 +67,7 @@ module Link = {
6167
~target: string=?,
6268
~id: string=?,
6369
~to: to,
70+
~preventScrollReset: bool=?,
6471
) => React.element = "Link"
6572
}
6673

@@ -72,6 +79,7 @@ module Link = {
7279
~className: string=?,
7380
~target: string=?,
7481
~to: string,
82+
~preventScrollReset: bool=?,
7583
) => React.element = "Link"
7684
}
7785
}

src/layouts/SidebarLayout.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module Toc = {
3232
onClick={_evt => scrollToAnchor(href)}
3333
to=href
3434
className="font-normal block text-14 text-gray-40 leading-tight hover:text-gray-80"
35+
preventScrollReset=true
3536
>
3637
{//links, nested
3738
React.string(header)}

0 commit comments

Comments
 (0)