Skip to content

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

@philmetzger

Description

@philmetzger

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions