diff --git a/packages/core/src/components/_utils/web-view/WebView.tsx b/packages/core/src/components/_utils/web-view/WebView.tsx index 9600f81f..7bee5a65 100644 --- a/packages/core/src/components/_utils/web-view/WebView.tsx +++ b/packages/core/src/components/_utils/web-view/WebView.tsx @@ -30,11 +30,23 @@ export const WebView: FC = forwardRef(({ source }; }, [focus, hovered]); - const onMouseOver = () => { + const onMouseEnter = () => { setHovered(true); }; - const onMouseOut = () => { + const onMouseLeave = (e: React.MouseEvent) => { + // In Firefox, entering an iframe triggers a mouseleave event because it's a different document. + // We verify if the mouse is still within the bounds of the WebView to prevent losing hover state. + const rect = e.currentTarget.getBoundingClientRect(); + if ( + e.clientX > rect.left && + e.clientX < rect.right && + e.clientY > rect.top && + e.clientY < rect.bottom + ) { + return; + } + window.focus(); setHovered(false); }; @@ -47,7 +59,7 @@ export const WebView: FC = forwardRef(({ source delete iframeProps.setIconUrl; delete iframeProps.standalone; - return
+ return