Add useLockBodyScroll hook (sets overflow:hidden on body, restores on unmount) and apply it to ColorPicker, AdminColorFilter, WelcomeModal, and GuidedTour. CartDrawer uses an inline effect keyed on drawerOpen since it is always mounted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
11 lines
316 B
TypeScript
11 lines
316 B
TypeScript
import { useEffect } from 'react'
|
|
|
|
/** Locks body scroll while the calling component is mounted. */
|
|
export function useLockBodyScroll() {
|
|
useEffect(() => {
|
|
const prev = document.body.style.overflow
|
|
document.body.style.overflow = 'hidden'
|
|
return () => { document.body.style.overflow = prev }
|
|
}, [])
|
|
}
|