@@ -102,22 +102,24 @@ export const Tooltip = forwardRef(
102102 < TooltipPrimitive . Trigger asChild { ...triggerProps } >
103103 { children }
104104 </ TooltipPrimitive . Trigger >
105- < TooltipPrimitive . Portal >
106- < Content
107- ref = { ref }
108- side = "top"
109- align = "center"
110- sideOffset = { 2 }
111- collisionPadding = { 8 }
112- arrowPadding = { 8 }
113- { ...props }
114- >
115- { typeof content === "string" ? < Text > { content } </ Text > : content }
116- < Box css = { { color : theme . colors . transparentExtreme } } >
117- < Arrow offset = { 5 } width = { 11 } height = { 5 } />
118- </ Box >
119- </ Content >
120- </ TooltipPrimitive . Portal >
105+ { content != null && (
106+ < TooltipPrimitive . Portal >
107+ < Content
108+ ref = { ref }
109+ side = "top"
110+ align = "center"
111+ sideOffset = { 2 }
112+ collisionPadding = { 8 }
113+ arrowPadding = { 8 }
114+ { ...props }
115+ >
116+ { typeof content === "string" ? < Text > { content } </ Text > : content }
117+ < Box css = { { color : theme . colors . transparentExtreme } } >
118+ < Arrow offset = { 5 } width = { 11 } height = { 5 } />
119+ </ Box >
120+ </ Content >
121+ </ TooltipPrimitive . Portal >
122+ ) }
121123 </ TooltipPrimitive . Root >
122124 ) ;
123125 }
@@ -202,12 +204,11 @@ export const InputErrorsTooltip = ({
202204 }
203205 } , [ ] ) ;
204206
205- // We intentionally always pass non empty content to avoid optimization inside Tooltip
206- // where it renders {children} directly if content is empty.
207- // If this optimization accur, the input will remount which will cause focus loss
208- // and current value loss.
207+ // Wrap the error tooltip with its own provider to avoid logic intersection with ordinary tooltips.
208+ // This is especially important for hover delays.
209+ // Here we ensure that hovering over the tooltip trigger after any input will not show the tooltip immediately.
209210 return (
210- < >
211+ < TooltipProvider >
211212 < Box ref = { ref as never } css = { { display : "contents" } } > </ Box >
212213 < Tooltip
213214 { ...rest }
@@ -225,6 +226,6 @@ export const InputErrorsTooltip = ({
225226 >
226227 { children }
227228 </ Tooltip >
228- </ >
229+ </ TooltipProvider >
229230 ) ;
230231} ;
0 commit comments