VS Code Codex prompt loses focus after Alt+Tab because Alt activates File menu

Open 💬 1 comment Opened Jun 10, 2026 by joekramer-as

What version of the IDE extension are you using?

26.506.31421

What subscription do you have?

Business

Which IDE are you using?

VS Code

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

The Codex prompt textbox in VS Code intermittently loses focus after switching away from VS Code and returning with Alt+Tab on Windows.

After further testing, the focus loss appears to be caused by VS Code treating the Alt key from the Alt+Tab window switch as a menu activation. When the issue occurs, focus lands on the VS Code File menu instead of returning to the Codex prompt textbox.

This interrupts typing flow during iterative work because the prompt textbox no longer receives keyboard input after returning to VS Code.

Environment:

VS Code version: Code 1.118.1 (034f571, 2026-04-29T17:36:44+03:00)
OS version: Windows_NT x64 10.0.26200
Codex VS Code extension: openai.chatgpt / chatgpt, version 26.417.40842
Microsoft VS Code issue: https://github.com/microsoft/vscode/issues/313731

Steps to reproduce:

Open VS Code on Windows.
Open the Codex extension UI.
Click into the Codex prompt textbox.
Type some text or leave the prompt focused.
Use Alt+Tab to switch to another application.
Use Alt+Tab to return to VS Code.
Observe whether keyboard focus remains in the Codex prompt textbox.

Expected result:

Focus should return to the Codex prompt textbox after returning to VS Code, so typing can continue immediately.

Actual result:

Intermittently, focus is stolen from the Codex prompt textbox. When this occurs, focus appears to land on the VS Code File menu, consistent with Alt being interpreted as a standalone menu activation after the Alt+Tab sequence.

Additional observations:

The issue is intermittent.
Sometimes focus stays in the Codex prompt textbox for many Alt+Tab cycles.
Other times, focus moves to the File menu after returning to VS Code.
I disabled and closed Codex, then tested Alt+Tab focus behavior in a normal editor tab. I did not reproduce the issue there.
I have only observed this while the Codex UI has focus.
Microsoft closed the VS Code issue as caused by extension behavior because Codex provides its own chat UI.

Why this may involve Codex:

The issue appears specific to the Codex extension UI or its interaction with VS Code/Electron focus restoration. The visible failure mode is menu-bar activation, but I have not reproduced it in a normal VS Code editor tab with Codex disabled.

Please investigate whether the Codex webview/prompt focus handling can prevent Alt+Tab from leaving focus on the VS Code menu bar, or whether this should be routed back to VS Code/Electron with extension-specific reproduction details.

What steps can reproduce the bug?

Open VS Code on Windows.
Open the Codex extension UI.
Click into the Codex prompt textbox.
Type some text or leave the prompt focused.
Use Alt+Tab to switch to another application.
Use Alt+Tab to return to VS Code.
Observe whether keyboard focus remains in the Codex prompt textbox.

What is the expected behavior?

Focus should return to the Codex prompt textbox after returning to VS Code, so typing can continue immediately.

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗