diff --git a/apps/builder/src/components/VariableSearchInput.tsx b/apps/builder/src/components/VariableSearchInput.tsx index 787c29ec3..c520f6f7f 100644 --- a/apps/builder/src/components/VariableSearchInput.tsx +++ b/apps/builder/src/components/VariableSearchInput.tsx @@ -20,6 +20,7 @@ import React, { useState, useRef, ChangeEvent, useEffect } from 'react' import { useDebouncedCallback } from 'use-debounce' import { byId, env, isDefined, isNotDefined } from 'utils' import { useOutsideClick } from '@/hooks/useOutsideClick' +import { useParentModal } from '@/features/graph' type Props = { initialVariableId?: string @@ -62,6 +63,7 @@ export const VariableSearchInput = ({ const inputRef = useRef(null) const createVariableItemRef = useRef(null) const itemsRef = useRef<(HTMLButtonElement | null)[]>([]) + const { ref: parentModalRef } = useParentModal() useOutsideClick({ ref: dropdownRef, @@ -190,7 +192,7 @@ export const VariableSearchInput = ({ {...inputProps} /> - + - - - + + + + + )} {typebot && isMediaBubbleBlock(block) && ( diff --git a/apps/builder/src/features/graph/components/Nodes/BlockNode/SettingsPopoverContent/SettingsModal.tsx b/apps/builder/src/features/graph/components/Nodes/BlockNode/SettingsPopoverContent/SettingsModal.tsx index 3ee6fbaf0..88b116653 100644 --- a/apps/builder/src/features/graph/components/Nodes/BlockNode/SettingsPopoverContent/SettingsModal.tsx +++ b/apps/builder/src/features/graph/components/Nodes/BlockNode/SettingsPopoverContent/SettingsModal.tsx @@ -1,3 +1,4 @@ +import { useParentModal } from '@/features/graph' import { Modal, ModalOverlay, @@ -20,13 +21,14 @@ export const SettingsModal = ({ onClose, ...props }: Props & ModalBodyProps) => { + const { ref } = useParentModal() const handleMouseDown = (e: React.MouseEvent) => { e.stopPropagation() } return ( - + diff --git a/apps/builder/src/features/graph/index.ts b/apps/builder/src/features/graph/index.ts index c81050e2c..56c976f7d 100644 --- a/apps/builder/src/features/graph/index.ts +++ b/apps/builder/src/features/graph/index.ts @@ -1,10 +1,12 @@ export { Graph } from './components/Graph' export { + ParentModalProvider, GraphProvider, GroupsCoordinatesProvider, GraphDndProvider, type Coordinates, useGraph, useBlockDnd, + useParentModal, } from './providers' export { parseNewBlock } from './utils' diff --git a/apps/builder/src/features/graph/providers/ParentModalProvider.tsx b/apps/builder/src/features/graph/providers/ParentModalProvider.tsx new file mode 100644 index 000000000..cf67919fa --- /dev/null +++ b/apps/builder/src/features/graph/providers/ParentModalProvider.tsx @@ -0,0 +1,17 @@ +import { createContext, ReactNode, useContext, useRef } from 'react' + +const parentModalContext = createContext<{ + ref?: React.MutableRefObject +}>({}) + +export const ParentModalProvider = ({ children }: { children: ReactNode }) => { + const ref = useRef(null) + + return ( + + {children} + + ) +} + +export const useParentModal = () => useContext(parentModalContext) diff --git a/apps/builder/src/features/graph/providers/index.ts b/apps/builder/src/features/graph/providers/index.ts index a13a0d644..152b1c58a 100644 --- a/apps/builder/src/features/graph/providers/index.ts +++ b/apps/builder/src/features/graph/providers/index.ts @@ -1,3 +1,4 @@ export * from './GraphDndProvider' export * from './GraphProvider' export * from './GroupsCoordinateProvider' +export * from './ParentModalProvider' diff --git a/apps/builder/src/lib/theme.ts b/apps/builder/src/lib/theme.ts index 3dc1cb1cb..86bbf273e 100644 --- a/apps/builder/src/lib/theme.ts +++ b/apps/builder/src/lib/theme.ts @@ -93,7 +93,6 @@ const Popover = createMultiStyleConfigHelpers( popper: { width: 'fit-content', maxWidth: 'fit-content', - zIndex: 'popover', }, content: { bg: colorMode === 'dark' ? 'gray.800' : 'white',