Skip to content

Commit

Permalink
chore(deps): deprecates body-scroll-lock
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsfletch committed Jan 30, 2025
1 parent 8a79e59 commit c7ad46c
Show file tree
Hide file tree
Showing 4 changed files with 3,067 additions and 8,760 deletions.
2 changes: 0 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
"@faceless-ui/window-info": "3.0.0-beta.0",
"@monaco-editor/react": "4.6.0",
"@payloadcms/translations": "workspace:*",
"body-scroll-lock": "4.0.0-beta.0",
"bson-objectid": "2.0.4",
"date-fns": "4.1.0",
"dequal": "2.0.3",
Expand All @@ -147,7 +146,6 @@
"@babel/preset-typescript": "7.26.0",
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
"@payloadcms/eslint-config": "workspace:*",
"@types/body-scroll-lock": "^3.1.0",
"@types/react": "19.0.1",
"@types/react-dom": "19.0.1",
"@types/uuid": "10.0.0",
Expand Down
7 changes: 3 additions & 4 deletions packages/ui/src/elements/Nav/context.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'
import { useWindowInfo } from '@faceless-ui/window-info'
import { clearAllBodyScrollLocks, disableBodyScroll, enableBodyScroll } from 'body-scroll-lock'
import React, { useEffect, useRef } from 'react'

import { usePreferences } from '../../providers/Preferences/index.js'
Expand Down Expand Up @@ -73,9 +72,9 @@ export const NavProvider: React.FC<{
useEffect(() => {
if (navRef.current) {
if (navOpen && midBreak) {
disableBodyScroll(navRef.current)
navRef.current.style.overscrollBehavior = 'contain'
} else {
enableBodyScroll(navRef.current)
navRef.current.style.overscrollBehavior = 'auto'
}
}
}, [navOpen, midBreak])
Expand All @@ -97,7 +96,7 @@ export const NavProvider: React.FC<{
// when the component unmounts, clear all body scroll locks
useEffect(() => {
return () => {
clearAllBodyScrollLocks()
navRef.current.style.overscrollBehavior = 'auto'
}
}, [])

Expand Down
Loading

0 comments on commit c7ad46c

Please sign in to comment.