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 108108 "parse-cache-control": "^1.0.1",
109109 "partial-json": "^0.1.7",
110110 "react": "^19.0.0",
111+ "react-aria": "^3.37.0",
111112 "react-dom": "^19.0.0",
112113 "react-hotkeys-hook": "^4.4.1",
113114 "rehype-sanitize": "^6.0.0",
Original file line number Diff line number Diff line change 3737 "@tailwindcss/typography" : " ^0.5.16" ,
3838 "ai" : " ^4.2.2" ,
3939 "assert-never" : " ^1.2.1" ,
40+ "react-aria" : " ^3.37.0" ,
4041 "bun-types" : " ^1.1.20" ,
4142 "classnames" : " ^2.5.1" ,
4243 "event-iterator" : " ^2.0.0" ,
Original file line number Diff line number Diff line change 33import { useMobileMenuSheet } from '@/components/MobileMenu' ;
44import { usePathname } from 'next/navigation' ;
55import { useEffect } from 'react' ;
6+ import { usePreventScroll } from 'react-aria' ;
67
78export function MobileMenuScript ( ) {
89 const pathname = usePathname ( ) ;
@@ -13,14 +14,10 @@ export function MobileMenuScript() {
1314 setOpen ( false ) ;
1415 } , [ pathname ] ) ;
1516
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+ } ) ;
2421
2522 return null ;
2623}
You can’t perform that action at this time.
0 commit comments