Fix modals on iOS

This commit is contained in:
Mark McDowall
2026-05-25 20:21:15 -07:00
parent f334bbb4d9
commit fb7f3badd3
3 changed files with 1 additions and 14 deletions
-6
View File
@@ -30,12 +30,6 @@
overflow: hidden !important;
}
.modalOpenIOS {
position: fixed;
right: 0;
left: 0;
}
/*
* Sizes
*/
-1
View File
@@ -10,7 +10,6 @@ interface CssExports {
'modalBackdrop': string;
'modalContainer': string;
'modalOpen': string;
'modalOpenIOS': string;
'small': string;
}
export const cssExports: CssExports;
+1 -7
View File
@@ -71,7 +71,6 @@ function Modal({
}: ModalProps) {
const backgroundRef = useRef<HTMLDivElement>(null);
const isBackdropPressed = useRef(false);
const bodyScrollTop = useRef(0);
const wasOpen = usePrevious(isOpen);
const modalId = useId();
@@ -128,8 +127,6 @@ function Modal({
if (openModals.length === 1) {
if (isIOS()) {
setScrollLock(true);
bodyScrollTop.current = document.body.scrollTop;
elementClass(document.body).add(styles.modalOpenIOS);
} else {
elementClass(document.body).add(styles.modalOpen);
}
@@ -138,11 +135,8 @@ function Modal({
removeFromOpenModals(modalId);
if (openModals.length === 0) {
setScrollLock(false);
if (isIOS()) {
elementClass(document.body).remove(styles.modalOpenIOS);
document.body.scrollTop = bodyScrollTop.current;
setScrollLock(false);
} else {
elementClass(document.body).remove(styles.modalOpen);
}