This Pull Request introduces a new feature: the ability to delay "hide on leave".
One of my major pain points with the UX of this package was that hideOnLeave triggered instantly, so the slightest movement of my mouse outside the menu would close it. But I also did not want to have to leave the menu open until the user intentionally exits it.
This introduces a new prop to the ContextMenu component called hideOnLeaveDelay. By default it is 0, and if it is 0 it is ignored. You can set it to a millisecond value to delay the actual hiding of the menu, which is controlled using setTimeout inside of the onMouseLeave event that the nav in the render tree of ContextMenu emits. This timeout is cleared whenever the user's mouse re-enters the ContextMenu, or when the user intentionally clicks outside of the menu, as well as when in the componentWillUnmount lifecycle method.
All unit tests pass, with an additional unit test being added to test specific hideOnLeaveDelay behavior.
This Pull Request introduces a new feature: the ability to delay "hide on leave".
One of my major pain points with the UX of this package was that
hideOnLeave
triggered instantly, so the slightest movement of my mouse outside the menu would close it. But I also did not want to have to leave the menu open until the user intentionally exits it.This introduces a new prop to the
ContextMenu
component calledhideOnLeaveDelay
. By default it is0
, and if it is0
it is ignored. You can set it to a millisecond value to delay the actual hiding of the menu, which is controlled usingsetTimeout
inside of theonMouseLeave
event that thenav
in the render tree ofContextMenu
emits. This timeout is cleared whenever the user's mouse re-enters theContextMenu
, or when the user intentionally clicks outside of the menu, as well as when in thecomponentWillUnmount
lifecycle method.All unit tests pass, with an additional unit test being added to test specific
hideOnLeaveDelay
behavior.