Skip to content
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

Open
praimmugen opened this issue Jun 27, 2022 · 164 comments
Assignees
Labels
Area-Windowing Window frame, quake mode, tearout Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal.

Comments

@praimmugen
Copy link

praimmugen commented Jun 27, 2022

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.

@praimmugen praimmugen added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jun 27, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 27, 2022
@praimmugen praimmugen changed the title Cannot type in new pane or tab until focus is manually actived with mouse click Cannot type in new pane or tab until focus is manually activated with mouse click Jun 27, 2022
@lhecker
Copy link
Member

lhecker commented Jun 27, 2022

I can't reproduce this issue, unless it's an initial launch of WSL. Does your issue happen with WSL or with any shell?

@praimmugen
Copy link
Author

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

winterm-settings.json.zip

@jamesmcdonald
Copy link

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.

@elouanKeryell-Even
Copy link

same issue here, cannot seem to get the focus on a newly opened tab

@zadjii-msft
Copy link
Member

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.

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 26, 2022
@praimmugen
Copy link
Author

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 tab has no effect - I can't see anything getting focus no matter how many times I press the key.

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).

Not sure it changes things, but in my case focus is also lost when opening new WSL panes within a tab.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jul 26, 2022
@zadjii-msft
Copy link
Member

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

@zadjii-msft zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jul 26, 2022
@praimmugen
Copy link
Author

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.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jul 27, 2022
@zadjii-msft
Copy link
Member

zadjii-msft commented Aug 1, 2022

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.

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Priority-2 A description (P2) Area-Windowing Window frame, quake mode, tearout labels Aug 1, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Aug 1, 2022
@zadjii-msft zadjii-msft added this to the Terminal v1.16 milestone Aug 1, 2022
@zadjii-msft zadjii-msft self-assigned this Aug 1, 2022
@zadjii-msft zadjii-msft removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Aug 1, 2022
@matthuisman
Copy link

matthuisman commented Aug 8, 2022

I have similar issue, but only using command prompt in terminal.
Does not get focus. Need to click to allow typing
Multiple laptops at my company have same issue - so it may be something they have installed...

@tomhallertech
Copy link

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!

@prlcutting
Copy link

I'm running 1.17.11461.0, and also regularly experiencing a loss of focus in the window. It's quite frustrating. My company also uses Beyond Trust.

@tomhallertech
Copy link

tomhallertech commented Sep 26, 2023

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.

@ashpika40
Copy link

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.

@zoulja

This comment was marked as spam.

@tomhallertech
Copy link

Thank you, ashpika40, the ALT-F4 trick is brilliant!
My solution now is to open one instance of WT with WSL running in one tab, start tmux and use that for running multiple sessions, splitting windows into panes, etc. For a keyboard-centric user like me this works much better, and you can use the same skills outside of Windows, in pure Linux, ssh sessions, etc etc. I could even do the same thing in cmd.exe, but colors and fonts are nicer in WT.

@MrStrik3
Copy link

MrStrik3 commented Oct 5, 2023

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!

@NinoDLC
Copy link

NinoDLC commented Nov 25, 2023

Same problem here, also when commiting with Git.

  • I commit with Git from the terminal : git commit
  • It launches Sublim Text (because of some Git config), I type my commit message, save and close the Sublim Text window
  • Terminal is focused but my tab isn't, I can't type anything until I clicked inside the tab

@zoulja
Copy link

zoulja commented Dec 11, 2023

Any update on this, dear sirs?

@ilyaradko
Copy link

@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.

@gsmalleus
Copy link

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.
If I launch it via the Start Menu, the window opens behind other open applications.

@zoulja
Copy link

zoulja commented Dec 12, 2023

@zoulja Yes. Someone should open a bug ticket at BeyondTrust :)

@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

@rwasef1830
Copy link

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 ?

@trueuto
Copy link

trueuto commented Dec 12, 2023

@rwasef1830 there were a couple possibilities mentioned earlier. You may want to refer to the following posts:

#13388 (comment)
#13388 (comment)
#13388 (comment)
#13388 (comment)

@likhonsible

This comment was marked as duplicate.

@zoulja
Copy link

zoulja commented Feb 27, 2024

Still suffering of it in 1.20 Preview

@inglepriyanka148867

This comment was marked as off-topic.

@inglepriyanka148867

This comment was marked as off-topic.

@Delphier
Copy link

Delphier commented May 6, 2024

1.19.11213, Windows 11 this issue still exists.

@MichaelMcCoyTech

This comment was marked as duplicate.

@wiz0u
Copy link

wiz0u commented May 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests