From 79fade5add6546c40b6ce72590fa7aad66eb1bd2 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Tue, 17 Mar 2026 16:32:59 -0700 Subject: [PATCH] Sync browser devtools preference on surface focus loss --- Sources/Panels/BrowserPanelView.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/Panels/BrowserPanelView.swift b/Sources/Panels/BrowserPanelView.swift index 2d45cfa9..96c468c7 100644 --- a/Sources/Panels/BrowserPanelView.swift +++ b/Sources/Panels/BrowserPanelView.swift @@ -536,6 +536,13 @@ struct BrowserPanelView: View { panel.invalidateAddressBarPageFocusRestoreAttempts() hideSuggestions() setAddressBarFocused(false, reason: "panelFocus.onChange.unfocused") + // Surface switches in split layouts can keep the browser visible, so + // `isVisibleInUI` never flips to false. Sample the real inspector + // state when focus leaves the panel as well, otherwise an X-close can + // leave the persisted DevTools intent stale until the next reattach. + DispatchQueue.main.async { + panel.syncDeveloperToolsPreferenceFromInspector() + } } syncWebViewResponderPolicyWithViewState( reason: "panelFocusChanged",