[Glitch] Fix Wrapstodon modal scrolling not working on iOS

Port 4323963053715c69e94ead125474ef0473b4100d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion 2025-12-11 15:25:28 +01:00 committed by Claire
parent 5e0db46b2a
commit aa067370d8
2 changed files with 18 additions and 6 deletions

View File

@ -10,19 +10,17 @@ $mobile-breakpoint: 540px;
} }
.modalWrapper { .modalWrapper {
position: absolute; box-sizing: border-box;
inset: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 100%;
padding: 40px; padding: 40px;
overflow-y: auto; overflow-y: auto;
pointer-events: none;
scrollbar-color: var(--color-text-secondary) var(--color-bg-secondary); scrollbar-color: var(--color-text-secondary) var(--color-bg-secondary);
@media (width < $mobile-breakpoint) { @media (width < $mobile-breakpoint) {
padding-top: 0; padding: 0;
padding-inline: 0;
} }
.loading-indicator .circular-progress { .loading-indicator .circular-progress {

View File

@ -1,7 +1,10 @@
import { useEffect } from 'react'; import { useCallback, useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { closeModal } from '@/flavours/glitch/actions/modal';
import { useAppDispatch } from '@/flavours/glitch/store';
import { AnnualReport } from '.'; import { AnnualReport } from '.';
import styles from './index.module.scss'; import styles from './index.module.scss';
@ -12,13 +15,24 @@ const AnnualReportModal: React.FC<{
onChangeBackgroundColor('var(--color-bg-media-base)'); onChangeBackgroundColor('var(--color-bg-media-base)');
}, [onChangeBackgroundColor]); }, [onChangeBackgroundColor]);
const dispatch = useAppDispatch();
const handleCloseModal = useCallback(() => {
dispatch(closeModal({ modalType: 'ANNUAL_REPORT', ignoreFocus: false }));
}, [dispatch]);
return ( return (
// It's fine not to provide a keyboard handler here since there is a global
// [Esc] key listener that will close open modals.
// This onClick handler is needed since the modalWrapper styles overlap the
// default modal backdrop, preventing clicks to pass through.
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
<div <div
className={classNames( className={classNames(
'modal-root__modal', 'modal-root__modal',
styles.modalWrapper, styles.modalWrapper,
'theme-dark', 'theme-dark',
)} )}
onClick={handleCloseModal}
> >
<AnnualReport context='modal' /> <AnnualReport context='modal' />
</div> </div>