Fix wrapstodon modal closing on any click (#37209)

pull/37213/head
Claire 3 months ago committed by GitHub
parent c06eb371e6
commit dfbf908870
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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

Loading…
Cancel
Save