@@ -63,6 +63,7 @@ export interface NotificationProps {
6363 pauseOnHover ?: boolean ;
6464
6565 // Function
66+ onHover ?: ( hovering : boolean ) => void ;
6667 onClick ?: React . MouseEventHandler < HTMLDivElement > ;
6768 onMouseEnter ?: React . MouseEventHandler < HTMLDivElement > ;
6869 onMouseLeave ?: React . MouseEventHandler < HTMLDivElement > ;
@@ -99,6 +100,7 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
99100 pauseOnHover = true ,
100101
101102 // Function
103+ onHover,
102104 onClick,
103105 onMouseEnter,
104106 onMouseLeave,
@@ -136,7 +138,18 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
136138 } , [ forcedHovering , hovering , onPause , onResume , pauseOnHover ] ) ;
137139
138140 // ========================= Hover ==========================
141+ const hoveringRef = React . useRef ( false ) ;
142+ const onInternalHover = useEvent ( ( nextHovering : boolean ) => {
143+ if ( nextHovering || hoveringRef . current ) {
144+ onHover ?.( nextHovering ) ;
145+ }
146+ hoveringRef . current = nextHovering ;
147+ } ) ;
148+
149+ React . useEffect ( ( ) => ( ) => onInternalHover ( false ) , [ onInternalHover ] ) ;
150+
139151 function onInternalMouseEnter ( event : React . MouseEvent < HTMLDivElement > ) {
152+ onInternalHover ( true ) ;
140153 setHovering ( true ) ;
141154 if ( pauseOnHover ) {
142155 onPause ( ) ;
@@ -145,6 +158,8 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
145158 }
146159
147160 function onInternalMouseLeave ( event : React . MouseEvent < HTMLDivElement > ) {
161+ // Normal exits are handled by the list, including movement through its gaps.
162+ hoveringRef . current = false ;
148163 setHovering ( false ) ;
149164 if ( pauseOnHover && ! forcedHovering ) {
150165 onResume ( ) ;
0 commit comments