Skip to content

Commit c7ad46c

Browse files
committed
chore(deps): deprecates body-scroll-lock
1 parent 8a79e59 commit c7ad46c

File tree

4 files changed

+3067
-8760
lines changed

4 files changed

+3067
-8760
lines changed

packages/ui/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
"@faceless-ui/window-info": "3.0.0-beta.0",
124124
"@monaco-editor/react": "4.6.0",
125125
"@payloadcms/translations": "workspace:*",
126-
"body-scroll-lock": "4.0.0-beta.0",
127126
"bson-objectid": "2.0.4",
128127
"date-fns": "4.1.0",
129128
"dequal": "2.0.3",
@@ -147,7 +146,6 @@
147146
"@babel/preset-typescript": "7.26.0",
148147
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
149148
"@payloadcms/eslint-config": "workspace:*",
150-
"@types/body-scroll-lock": "^3.1.0",
151149
"@types/react": "19.0.1",
152150
"@types/react-dom": "19.0.1",
153151
"@types/uuid": "10.0.0",

packages/ui/src/elements/Nav/context.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client'
22
import { useWindowInfo } from '@faceless-ui/window-info'
3-
import { clearAllBodyScrollLocks, disableBodyScroll, enableBodyScroll } from 'body-scroll-lock'
43
import React, { useEffect, useRef } from 'react'
54

65
import { usePreferences } from '../../providers/Preferences/index.js'
@@ -73,9 +72,9 @@ export const NavProvider: React.FC<{
7372
useEffect(() => {
7473
if (navRef.current) {
7574
if (navOpen && midBreak) {
76-
disableBodyScroll(navRef.current)
75+
navRef.current.style.overscrollBehavior = 'contain'
7776
} else {
78-
enableBodyScroll(navRef.current)
77+
navRef.current.style.overscrollBehavior = 'auto'
7978
}
8079
}
8180
}, [navOpen, midBreak])
@@ -97,7 +96,7 @@ export const NavProvider: React.FC<{
9796
// when the component unmounts, clear all body scroll locks
9897
useEffect(() => {
9998
return () => {
100-
clearAllBodyScrollLocks()
99+
navRef.current.style.overscrollBehavior = 'auto'
101100
}
102101
}, [])
103102

0 commit comments

Comments
 (0)