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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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