[Glitch] Fix wrapstodon modal closing on any click

Port dfbf908870 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire
2025-12-11 18:49:26 +01:00
parent 183a42a5ee
commit a56b739c68

View File

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