-
Notifications
You must be signed in to change notification settings - Fork 469
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2319 from dfinity/akos/fix-mobile-nav-on-ai-popup
fix: nav vs ai popup z-index; add blur to transparent bg nav
- Loading branch information
Showing
8 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.mantine-Modal-root { | ||
z-index: 1001; | ||
position: relative; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useEffect } from "react"; | ||
|
||
const useLockBodyScroll = (modalRef: React.RefObject<HTMLDivElement>) => { | ||
useEffect(() => { | ||
// Get original body overflow | ||
const originalStyle = window.getComputedStyle(document.body).overflow; | ||
const originalTouchAction = window.getComputedStyle( | ||
document.body | ||
).touchAction; | ||
|
||
// Prevent scrolling on mount | ||
document.body.style.overflow = "hidden"; | ||
document.body.style.touchAction = "none"; | ||
|
||
// Re-enable scrolling when component unmounts | ||
return () => { | ||
document.body.style.overflow = originalStyle; | ||
document.body.style.touchAction = originalTouchAction; | ||
}; | ||
}, [modalRef]); // Empty array ensures effect is only run on mount and unmount | ||
}; | ||
|
||
export default useLockBodyScroll; |