From 9a0324b0554bd9eda1c3ccb700b7cee1ebfa6665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 17 Aug 2024 00:37:48 +0200 Subject: [PATCH] Only apply the modal+dropdown workaround to touchscreen devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/components/modal-root.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/modal-root.tsx b/src/components/modal-root.tsx index 70a9ccf30..1a4ab2572 100644 --- a/src/components/modal-root.tsx +++ b/src/components/modal-root.tsx @@ -9,6 +9,7 @@ import { saveDraftStatus } from 'soapbox/actions/draft-statuses'; import { cancelEventCompose } from 'soapbox/actions/events'; import { openModal, closeModal } from 'soapbox/actions/modals'; import { useAppDispatch, useAppSelector, usePrevious } from 'soapbox/hooks'; +import { userTouching } from 'soapbox/is-mobile'; import type { ModalType } from 'soapbox/features/ui/components/modal-root'; import type { ReducerCompose } from 'soapbox/reducers/compose'; @@ -220,6 +221,8 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) }, [children]); useEffect(() => { + if (!userTouching.matches) return; + if (isDropdownOpen && unlistenHistory.current) { unlistenHistory.current(); } else if (!isDropdownOpen && wasDropdownOpen) {