Disables body scroll when in fullscreen mode
Prevents the body from scrolling when the player is in fullscreen mode, enhancing the user experience. Re-enables body scroll when exiting fullscreen.
This commit is contained in:
@@ -79,6 +79,22 @@ export function Player({ className }: PlayerProps) {
|
|||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
// Handle body scroll when in fullscreen
|
||||||
|
useEffect(() => {
|
||||||
|
if (displayMode === 'maximized') {
|
||||||
|
// Disable body scroll
|
||||||
|
document.body.style.overflow = 'hidden'
|
||||||
|
} else {
|
||||||
|
// Re-enable body scroll
|
||||||
|
document.body.style.overflow = 'unset'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup when component unmounts
|
||||||
|
return () => {
|
||||||
|
document.body.style.overflow = 'unset'
|
||||||
|
}
|
||||||
|
}, [displayMode])
|
||||||
|
|
||||||
const executeAction = useCallback(async (action: () => Promise<void | MessageResponse>, actionName: string) => {
|
const executeAction = useCallback(async (action: () => Promise<void | MessageResponse>, actionName: string) => {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user