Thanks for your work on this library. It's been very useful so far!
Anyway, I'm developing a react app that is using react-cursor-position to capture the cursor position for a given div and whether or not the cursor is positioned inside a div.
Sadly, there is an issue with the mouseEnter event not being triggered on close of a custom modal div. Specifically, when the mouse is positioned over an element that contains a ReactCursorPosition component and the modal is closed, typically via a click, the mouseEnter event does not trigger upon the cursor "entering" the element. As I am relying on the isActive prop to be true when the element is in a hover state, this is problematic as isActive is set to true from the onMouseEnter function being called.
In my initial investigation into this issue, adding a mouseOver event listener that calls onMouseEnter
instead of onMouseEnter on the same div where the mouseEnter listener was present, fixes the issue, but it is not entirely clear why. I'm guessing it is because the cursor never actually "enters" the element when the modal closes, if "entering" means crossing into an element from its outer border. I also came across this explanation of the differences between mouseEnter and mouseOver, but it doesn't really clear much up.
Also, onMouseOver does trigger more frequently, so some check would have to be in place to make sure you aren't running the "onEnter" code more than once. It does work without such a check, but it doesn't make sense to call the code in onMouseEnter
multiple times.
Is there a specific reason you are using onMouseEnter over onMouseOver? Either way, I'm hoping there is some solution for this issue. I can provide more details if needed and also make a PR with proposed changes if you think listening to the mouseOver event could work.