react-laag icon indicating copy to clipboard operation
react-laag copied to clipboard

How do you handle cases where a modal is shown from clicking in a layer

Open philmetzger opened this issue 1 year ago • 2 comments

I have created a dropdown component:

const { renderLayer, triggerProps, layerProps } = useLayer({
    isOpen: isVisible,
    onOutsideClick: () => setIsVisible(false),
    overflowContainer: true,
    auto: true, // Automatically find the best placement.
    placement,
    triggerOffset: 5,
    onDisappear: (_disappearType) => {
      if (_disappearType === disappearType) {
        setIsVisible(false);
      }
    },
  });

Now in my dropdown I load a Modal. However as soon as i click anywhere in the modal, then everything closes because of onOutsideClick: () => setIsVisible(false)

Is there a nice solution for this so if something is above the dropdown, like a modal, to ignore the click outside?

philmetzger avatar Feb 06 '23 14:02 philmetzger