about summary refs log tree commit diff
path: root/src/view/com/composer/Composer.tsx
diff options
context:
space:
mode:
authorMary <148872143+mary-ext@users.noreply.github.com>2024-01-19 13:25:03 +0700
committerGitHub <noreply@github.com>2024-01-18 22:25:03 -0800
commit5b20ad1ebd6d158702dcc5b9301d16a7d180be71 (patch)
tree894007bf4b40cf6c5d4a67e80862320ca60e1ff0 /src/view/com/composer/Composer.tsx
parent2f6c34d18d52fd5793664157876732a5adc35586 (diff)
downloadvoidsky-5b20ad1ebd6d158702dcc5b9301d16a7d180be71.tar.zst
Prevent close on backdrop for alt text edit modal (#2492)
* fix: don't close on backdrop for alt text edit

* fix: ignore esc key press if a modal is open
Diffstat (limited to 'src/view/com/composer/Composer.tsx')
-rw-r--r--src/view/com/composer/Composer.tsx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index 1c2e126c8..1ed6b98a5 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -74,7 +74,7 @@ export const ComposePost = observer(function ComposePost({
 }: Props) {
   const {currentAccount} = useSession()
   const {data: currentProfile} = useProfileQuery({did: currentAccount!.did})
-  const {activeModals} = useModals()
+  const {isModalActive, activeModals} = useModals()
   const {openModal, closeModal} = useModalControls()
   const {closeComposer} = useComposerControls()
   const {track} = useAnalytics()
@@ -176,11 +176,11 @@ export const ComposePost = observer(function ComposePost({
     [onPressCancel],
   )
   useEffect(() => {
-    if (isWeb) {
+    if (isWeb && !isModalActive) {
       window.addEventListener('keydown', onEscape)
       return () => window.removeEventListener('keydown', onEscape)
     }
-  }, [onEscape])
+  }, [onEscape, isModalActive])
 
   const onPressAddLinkCard = useCallback(
     (uri: string) => {