-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot type in new pane or tab until focus is manually activated with mouse click #13388
Comments
I can't reproduce this issue, unless it's an initial launch of WSL. Does your issue happen with WSL or with any shell? |
Hey, thanks for having a look at this. At the moment I can reproduce it with both WSL and Powershell profiles. However it's a lot less consistent than I thought initially. It doesn't make much sense, but mostly, after starting a new terminal, new tabs/panes are working fine (apart from the initial launch of WSL as you also noticed). However, if I switch to a different window for some time (seems like around a minute is enough, but 30 seconds is not), then go back to Windows Terminal (using Alt+Tab or mouse doesn't make a difference), I can experience the issue. At the moment the option "Automatically focus pane on mouse hover" is disabled, so I don't think that was necessarily making any difference like I said in the initial report. In case it helps, I'm attaching my settings.json |
I have an issue that might be related. If I open a terminal from the Start menu in Windows 11 by typing to search for "terminal", it almost always appears under other windows and fails to get focus. If I just click on the pinned icon in the Start menu without typing, this never happens. Opening a terminal with Win-x i also gets focus correctly, as does Ctrl-Shift-n from another terminal. This seems to be consistent with both Terminal (1.13.11432.0) and Terminal Preview (1.15.1863.0). My default profile is WSL, in case that makes a difference. The issue affects any new windows regardless of how many terminals I have open. |
same issue here, cannot seem to get the focus on a newly opened tab |
I'm gonna focus in on the PowerShell repro case here. The fact that the Terminal loses focus when a WSL tab is opened is a well-known bug (I believe in WSLg). I don't have any idea why this would happen. @praimmugen when the terminal does get into this state (where apparently nothig is focused), what does pressing tab do? That should move focus to the "next" UI element, which might help us figure out where focus is currently. |
Unfortunately, pressing
Not sure it changes things, but in my case focus is also lost when opening new WSL panes within a tab. |
Is there anything in your PowerShell profile? If pressing tab does nothing, then I'd suspect that maybe the Terminal HWND itself doesn't even have focus, and something else is the forground window. Maybe there's something in your profile.ps1 that's like, shelling out to WSL or something |
Nothing in my PS profile, it's completely empty. Long shot, but I also tried stopping a few apps that were running in background (things like AltDrag, AutoHotkey scripts, X server and several others), but unfortunately it didn't help. |
I WONDER. I wonder if this is another facet of #13589. Like, if the WS_TOOLWINDOW created by conpty becomes the foreground window for some reason? It absolutely never should, it's not visible but... clearly there's something weird happening. Maybe this is a clue as to why on Windows 10 the taskbar seems to think that it should restore the hidden window first. Maybe that's why we can't repro this either, we're checking on Windows 11. Hmm. NOTE TO SELF: Assigning to myself to investigate on the Win10 VM to see if I can't repro this. Also use as an opportunity to double check the taskbar code, and see what heuristic they're using, and why it thinks the conpty window is the one it should operate on. |
I have similar issue, but only using command prompt in terminal. |
I also lose focus in WSL constantlly. I have RSI and depend on using keyboard rather than mouse, and I can't even alt-tab to get the focus back - I have to actually click in the window, otherwise it's completely inaccessible. This is incredibly annoying. I would be using Linux on bare metal, not Windows at all, but my client thinks it's more secure to require all access to their systems to be via buggy vulnerable crappy software that just gets in the way of productivity. Please fix! |
I'm running |
I'm also running Windows Terminal 1.17.11461.0, and have Beyond Trust, on Windows 10 Enterprise 22H2 Build 19045.3448. 30 seconds after I open a WSL tab, focus is lost. Other application windows are unaffected, I can alt-tab to them and type. But pressing tab or alt-tab does not regain focus in the WSL tab, only a mouse click will do. The same thing happens when I open a Powershell or Command Prompt tab. It also happens if I close all WSL tabs, execute "wsl --shutdown" in a command prompt, then open a Command Prompt or Powershell tab in Windows Terminal - focus is lost after 30 seconds and only a mouse click can restore. So problem seems to be with Windows Terminal, not WSL. It's unclear from above comments whether this is necessarily to do with Beyond Trust. I can say however that I only experience this with Windows Terminal, no other application is similarly affected. In my normal workflow I open and close many WSL tabs, and I avoid using the mouse due to RSI, so this is both a usability and accessibility issue. |
Yeah, I have been having this problem for a while as well. I've just updated to version 1.18.2681.0, but still see this problem. I do have BeyondTrust installed. For people who don't want to use a mouse to regain focus, you can do an ALT+F4 when it loses focus. This way you can close the invisible box and the focus automatically regains on to the most recent terminal you are working on. |
This comment was marked as spam.
This comment was marked as spam.
Thank you, ashpika40, the ALT-F4 trick is brilliant! |
I would also like to add : if I open a new Windows Terminal tab or window, and quickly put the focus on a different application like Firefox, after a few seconds the application will lose its focus. The focus is brought to some kind of invisible tab in Windows Terminal (I also have BeyondTrust, it might be related or a coincidence) Thanks for looking into this problem, it's very appreciated! |
Same problem here, also when commiting with Git.
|
Any update on this, dear sirs? |
@zoulja Yes. Someone should open a bug ticket at BeyondTrust :) They are actually aware that their Privilege Manager does not behave good with some software and constantly fixing it. Unless someone opens a bug ticket, they will not be aware of this misbehavior with WT. |
I too am experiencing this behavior, but we do not utilize BeyondTrust. If launched via a pinned Task Bar icon, the window opens but does not have focus for input without clicking. |
@ilyaradko I'm facing this bug on my home laptop and I don't have BeyondTrust installed, so actually no need to wait for someone to make it fixed. It's obviously a regression which was introduced a few versions ago |
I am facing this since few weeks ago, I am not using BeyondTrust, but I am using other software that perform injection techniques such as StartAllBack and Proxifier. I am on Windows 11. Is there any low-level "who's asking for focus" tool to run so I can collect useful logs to add here ? |
@rwasef1830 there were a couple possibilities mentioned earlier. You may want to refer to the following posts: #13388 (comment) |
This comment was marked as duplicate.
This comment was marked as duplicate.
Still suffering of it in 1.20 Preview |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
1.19.11213, Windows 11 this issue still exists. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Yeah, Terminal is basically unusable with Visual Studio console programs unless this is fixed. You don't want to need a mouse click when you run/debug your program with F5, before typing things in the console. |
🎂 With a 2nd anniversary of this bug I wish everyone a quick breakthrough! It's been a pain in the neck for all users as well as developers as they are trying to fix something caused by the 3rd party apps in fact. These words are primarily aimed at you, @zadjii-msft - I hope this will be solved soon and you can forget about that once and for all and focus on some other, most likely much more interesting work! And thanks for all the efforts to have it sorted out! |
Windows Terminal version
1.14.1451.0
Windows build number
10.0.19042.0
Other Software
No response
Steps to reproduce
Create new pane/new tab
Expected Behavior
It is possible to type in the newly opened terminal
Actual Behavior
Unable to type until I click on the new terminal.
Note that enabling the option "Automatically focus pane on mouse hover" partially prevents the issue from happening.
It seems like focus is removed from all terminal tabs/panes whenever a new one is created.
The text was updated successfully, but these errors were encountered: