K
K
karmyskove2022-01-13 14:10:02
JavaScript
karmyskove, 2022-01-13 14:10:02

How to make the event not fire when hovering over Popover?

Hello! There is a component https://codepen.io/EugeneKarmyshkov/project/editor... , I can’t figure out how to make the onMouseLeave event not fire when hovering over Popover. MB can I add some condition to the handleCloseMenu?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
ParaBellum577, 2022-01-13
@karmyskove

You can farm something like such a check, we look, if there is a popover in the target, then we do not close the window

const handleCloseMenu = () => {
      if (!event.target?.className.includes("your_PopOver_classname or part_of_classname")) {
     setAnchorEl(null);
      }
    }
  };

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question