From dfbf908870fcde76396ebccfb3d71ee1a06ffe82 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 11 Dec 2025 18:49:26 +0100 Subject: [PATCH] Fix wrapstodon modal closing on any click (#37209) --- .../mastodon/features/annual_report/modal.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/javascript/mastodon/features/annual_report/modal.tsx b/app/javascript/mastodon/features/annual_report/modal.tsx index 7be8e529a04..c67a6ca19cc 100644 --- a/app/javascript/mastodon/features/annual_report/modal.tsx +++ b/app/javascript/mastodon/features/annual_report/modal.tsx @@ -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>( + (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