diff --git a/src/components/settings/ai-model-tab.tsx b/src/components/settings/ai-model-tab.tsx index 25cfef3..8bedda5 100755 --- a/src/components/settings/ai-model-tab.tsx +++ b/src/components/settings/ai-model-tab.tsx @@ -317,10 +317,13 @@ function ProviderConfigSection({ } const handleOAuthConnect = async (): Promise => { + // Open window immediately in the click handler to avoid + // popup blockers (async gap kills the user gesture) + const popup = window.open("about:blank", "_blank", "noopener") const { verifier, challenge } = await generatePKCE() const url = buildAuthUrl(challenge) + if (popup) popup.location.href = url setOAuth({ step: "connecting", verifier }) - window.open(url, "_blank", "noopener") } const handleOAuthSubmit = async (): Promise => {