File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,11 +84,19 @@ export const Tooltip = ({
8484 searchId . current = Date . now ( ) . toString ( 16 ) + Math . random ( ) . toString ( 16 ) . slice ( 2 ) ;
8585 setPlaceholder ( false ) ;
8686 } , swapDelayTime ) ;
87- if ( placeholderRef . current !== null )
87+ if ( placeholderRef . current !== null ) {
88+ const eventType = ev . type === "focusin" ? "focusout" : "mouseleave" ;
8889 ( placeholderRef . current as HTMLElement ) . addEventListener (
89- ev . type === "focusin" ? "focusout" : "mouseleave" ,
90- ( ) => clearTimeout ( swapDelay )
90+ eventType ,
91+ ( ) => {
92+ if ( eventType === "focusout" && eventMemory . current === "afterfocus" ||
93+ eventType === "mouseleave" && eventMemory . current === "afterhover" ) {
94+ eventMemory . current = null
95+ }
96+ clearTimeout ( swapDelay )
97+ }
9198 ) ;
99+ }
92100 } ;
93101 ( placeholderRef . current as HTMLElement ) . addEventListener ( "mouseenter" , swap ) ;
94102 ( placeholderRef . current as HTMLElement ) . addEventListener ( "focusin" , swap ) ;
You can’t perform that action at this time.
0 commit comments