diff --git a/Sources/Panels/BrowserPanelView.swift b/Sources/Panels/BrowserPanelView.swift index c30124a7..95716b7b 100644 --- a/Sources/Panels/BrowserPanelView.swift +++ b/Sources/Panels/BrowserPanelView.swift @@ -6098,6 +6098,10 @@ struct WebViewRepresentable: NSViewRepresentable { visibleInUI: coordinator.desiredPortalVisibleInUI, zPriority: coordinator.desiredPortalZPriority ) + BrowserWindowPortalRegistry.refresh( + webView: webView, + reason: "portalHostBind.didMoveToWindow" + ) BrowserWindowPortalRegistry.updatePaneTopChromeHeight( for: webView, height: coordinator.desiredPortalVisibleInUI ? paneTopChromeHeight : 0 @@ -6129,6 +6133,10 @@ struct WebViewRepresentable: NSViewRepresentable { visibleInUI: coordinator.desiredPortalVisibleInUI, zPriority: coordinator.desiredPortalZPriority ) + BrowserWindowPortalRegistry.refresh( + webView: webView, + reason: "portalHostBind.geometryChanged" + ) BrowserWindowPortalRegistry.updatePaneTopChromeHeight( for: webView, height: coordinator.desiredPortalVisibleInUI ? paneTopChromeHeight : 0 @@ -6166,6 +6174,14 @@ struct WebViewRepresentable: NSViewRepresentable { visibleInUI: coordinator.desiredPortalVisibleInUI, zPriority: coordinator.desiredPortalZPriority ) + // Force a rendering-state reattach after portal host replacement + // (e.g. after a pane split). Without this, WKWebView can freeze + // because _exitInWindow/_enterInWindow are never cycled when the + // web view is reparented to a new container during bind. + BrowserWindowPortalRegistry.refresh( + webView: webView, + reason: "portalHostBind" + ) coordinator.lastPortalHostId = hostId coordinator.lastSynchronizedHostGeometryRevision = geometryRevision }