Keep auth quick inputs open across focus changes (#6274)

VS Code dismisses QuickPick and InputBox prompts on focus loss unless ignoreFocusOut is enabled, which breaks the multi-step auth flow when users switch windows to copy provider details.

Constraint: VS Code extension API defaults ignoreFocusOut to false for quick inputs
Confidence: high
Scope-risk: narrow
Tested: npm test --workspace=packages/vscode-ide-companion -- src/webview/handlers/AuthMessageHandler.test.ts
Tested: npm run check-types --workspace=packages/vscode-ide-companion
Tested: npm run lint --workspace=packages/vscode-ide-companion
Tested: npm run build --workspace=packages/vscode-ide-companion
Tested: git diff --check
This commit is contained in:
Barry 2026-07-04 09:55:08 +08:00 committed by GitHub
parent 9b2fb30cb0
commit 3282c17b1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -41,6 +41,10 @@ describe('AuthMessageHandler', () => {
await handler.handle({ type: 'auth' });
expect(mockShowQuickPick).toHaveBeenCalledWith(
expect.any(Array),
expect.objectContaining({ ignoreFocusOut: true }),
);
expect(sendToWebView).toHaveBeenCalledWith({ type: 'authCancelled' });
});
@ -65,6 +69,9 @@ describe('AuthMessageHandler', () => {
await handler.handle({ type: 'auth' });
expect(mockShowInputBox).toHaveBeenCalledWith(
expect.objectContaining({ ignoreFocusOut: true }),
);
expect(sendToWebView).toHaveBeenCalledWith({ type: 'authCancelled' });
});

View file

@ -120,6 +120,7 @@ export class AuthMessageHandler extends BaseMessageHandler {
const choice = await vscode.window.showQuickPick(items, {
title,
placeHolder,
ignoreFocusOut: true,
});
if (!choice || choice.kind === vscode.QuickPickItemKind.Separator) {
this.notifyAuthCancelled();
@ -145,6 +146,7 @@ export class AuthMessageHandler extends BaseMessageHandler {
placeHolder: opts.placeHolder,
value: opts.value,
password: opts.password ?? false,
ignoreFocusOut: true,
validateInput: opts.required
? (v) => (!v?.trim() ? 'This field is required' : null)
: undefined,