@@ -102,7 +102,7 @@ export function useSetTooltipPosition(
102102 return ;
103103 }
104104
105- const tooltipEl = < HTMLElement > tooltipRef . value ;
105+ const tooltipEl = tooltipRef . value as HTMLElement ;
106106
107107 if ( tooltipEl && Helper . isFunction ( tooltipEl . getBoundingClientRect ) ) {
108108 const elRect = tooltipEl . getBoundingClientRect ( ) ;
@@ -125,38 +125,28 @@ export function useAddTooltipListener(
125125 return ;
126126 }
127127
128- let timer : number | undefined ;
129- const showTooltip = ( e : Event ) => {
130- if ( timer ) {
131- clearTimeout ( timer ) ;
132- }
133-
134- timer = Helper . defer ( ( ) => {
128+ const showTooltip = ( _e : Event ) => {
129+ window . requestAnimationFrame ( ( ) => {
135130 instance . emit ( 'update:show' , true ) ;
136131 active . value = true ;
137- } , 200 ) ;
138- // e.preventDefault();
139- e . stopPropagation ( ) ;
132+ } )
133+
134+ // preventEventTarget(e );
140135 } ;
141136 const hideTooltip = ( ) => {
142- if ( timer ) {
143- clearTimeout ( timer ) ;
144- }
145-
146137 instance . emit ( 'update:show' , false ) ;
147138 active . value = false ;
148139 } ;
149140
150141 const activatorEl = findActivatorElement ( instance ) as IHTMLElement | null ;
151142
152143 if ( activatorEl ) {
144+ const options = { capture : true , passive : false } ;
153145 ( activatorEl as IBindingElement ) . __mouseEvents = {
154- mouseEnter : EventListener . listen ( activatorEl , 'mouseenter' , showTooltip , {
155- passive : true ,
156- } ) ,
157- mouseLeave : EventListener . listen ( activatorEl , 'mouseleave' , hideTooltip , {
158- passive : true ,
159- } ) ,
146+ mouseEnter : EventListener . listen ( activatorEl , 'mouseenter' , showTooltip , options ) ,
147+ mouseLeave : EventListener . listen ( activatorEl , 'mouseleave' , hideTooltip , options ) ,
148+ focus : EventListener . listen ( activatorEl , 'focus' , showTooltip ) ,
149+ blur : EventListener . listen ( activatorEl , 'blur' , hideTooltip ) ,
160150 } ;
161151 }
162152}
@@ -167,9 +157,11 @@ export function useRemoveTooltipListener(instance?: ComponentInternalInstance |
167157
168158 if ( activatorEl ) {
169159 // @ts -ignore
170- const { mouseEnter, mouseLeave } = activatorEl . __mouseEvents ;
160+ const { mouseEnter, mouseLeave, focus , blur } = activatorEl . __mouseEvents ;
171161 ( mouseEnter as IEventResult ) . remove ( ) ;
172162 ( mouseLeave as IEventResult ) . remove ( ) ;
163+ ( focus as IEventResult ) . remove ( ) ;
164+ ( blur as IEventResult ) . remove ( ) ;
173165 activatorEl . __mouseEvents = undefined ;
174166 }
175167 }
0 commit comments