Fix wrapstodon modal closing on any click (#37209)

This commit is contained in:
Claire
2025-12-11 18:49:26 +01:00
committed by GitHub
parent c06eb371e6
commit dfbf908870

View File

@@ -16,9 +16,15 @@ const AnnualReportModal: React.FC<{
}, [onChangeBackgroundColor]); }, [onChangeBackgroundColor]);
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const handleCloseModal = useCallback(() => { const handleCloseModal = useCallback<React.MouseEventHandler<HTMLDivElement>>(
dispatch(closeModal({ modalType: 'ANNUAL_REPORT', ignoreFocus: false })); (e) => {
}, [dispatch]); if (e.target === e.currentTarget)
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 // It's fine not to provide a keyboard handler here since there is a global