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 openzio/stable
parent
2f6c34d18d
commit
5b20ad1ebd
|
@ -74,7 +74,7 @@ export const ComposePost = observer(function ComposePost({
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const {data: currentProfile} = useProfileQuery({did: currentAccount!.did})
|
const {data: currentProfile} = useProfileQuery({did: currentAccount!.did})
|
||||||
const {activeModals} = useModals()
|
const {isModalActive, activeModals} = useModals()
|
||||||
const {openModal, closeModal} = useModalControls()
|
const {openModal, closeModal} = useModalControls()
|
||||||
const {closeComposer} = useComposerControls()
|
const {closeComposer} = useComposerControls()
|
||||||
const {track} = useAnalytics()
|
const {track} = useAnalytics()
|
||||||
|
@ -176,11 +176,11 @@ export const ComposePost = observer(function ComposePost({
|
||||||
[onPressCancel],
|
[onPressCancel],
|
||||||
)
|
)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isWeb) {
|
if (isWeb && !isModalActive) {
|
||||||
window.addEventListener('keydown', onEscape)
|
window.addEventListener('keydown', onEscape)
|
||||||
return () => window.removeEventListener('keydown', onEscape)
|
return () => window.removeEventListener('keydown', onEscape)
|
||||||
}
|
}
|
||||||
}, [onEscape])
|
}, [onEscape, isModalActive])
|
||||||
|
|
||||||
const onPressAddLinkCard = useCallback(
|
const onPressAddLinkCard = useCallback(
|
||||||
(uri: string) => {
|
(uri: string) => {
|
||||||
|
|
|
@ -63,7 +63,11 @@ function Modal({modal}: {modal: ModalIface}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPressMask = () => {
|
const onPressMask = () => {
|
||||||
if (modal.name === 'crop-image' || modal.name === 'edit-image') {
|
if (
|
||||||
|
modal.name === 'crop-image' ||
|
||||||
|
modal.name === 'edit-image' ||
|
||||||
|
modal.name === 'alt-text-image'
|
||||||
|
) {
|
||||||
return // dont close on mask presses during crop
|
return // dont close on mask presses during crop
|
||||||
}
|
}
|
||||||
closeModal()
|
closeModal()
|
||||||
|
|
Loading…
Reference in New Issue