File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 108
108
"parse-cache-control": "^1.0.1",
109
109
"partial-json": "^0.1.7",
110
110
"react": "^19.0.0",
111
+ "react-aria": "^3.37.0",
111
112
"react-dom": "^19.0.0",
112
113
"react-hotkeys-hook": "^4.4.1",
113
114
"rehype-sanitize": "^6.0.0",
Original file line number Diff line number Diff line change 37
37
"@tailwindcss/typography" : " ^0.5.16" ,
38
38
"ai" : " ^4.2.2" ,
39
39
"assert-never" : " ^1.2.1" ,
40
+ "react-aria" : " ^3.37.0" ,
40
41
"bun-types" : " ^1.1.20" ,
41
42
"classnames" : " ^2.5.1" ,
42
43
"event-iterator" : " ^2.0.0" ,
Original file line number Diff line number Diff line change 3
3
import { useMobileMenuSheet } from '@/components/MobileMenu' ;
4
4
import { usePathname } from 'next/navigation' ;
5
5
import { useEffect } from 'react' ;
6
+ import { usePreventScroll } from 'react-aria' ;
6
7
7
8
export function MobileMenuScript ( ) {
8
9
const pathname = usePathname ( ) ;
@@ -13,14 +14,10 @@ export function MobileMenuScript() {
13
14
setOpen ( false ) ;
14
15
} , [ pathname ] ) ;
15
16
16
- useEffect ( ( ) => {
17
- // If the menu is open, we add a class to the body to prevent scrolling
18
- if ( open ) {
19
- document . body . style . overflow = 'hidden' ;
20
- } else {
21
- document . body . style . overflow = 'auto' ;
22
- }
23
- } , [ open ] ) ;
17
+ // Prevent scrolling when the menu is open
18
+ usePreventScroll ( {
19
+ isDisabled : ! open ,
20
+ } ) ;
24
21
25
22
return null ;
26
23
}
You can’t perform that action at this time.
0 commit comments