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

Terminal window not receiving focus if started via right mouse button menu in taskbar #8720

Closed
mavnorthwind opened this issue Jan 7, 2021 · 15 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Priority-3 A description (P3) Resolution-External For issues that are outside this codebase Tracking-External This bug isn't resolved, but it's following an external workitem.

Comments

@mavnorthwind
Copy link

Environment

Microsoft Windows [Version 10.0.19041.685]
Windows Terminal Version1.4.3243.0

Steps to reproduce

Select a different type of shell from the taskbar icon's context menu (probably named Tasks in English):
image

Expected behavior

Windows Terminal window appears with the desired type of shell and immediately receives focus, just like when you simply left-click on the taskbar icon.

Actual behavior

The main window appears, but doesn't receive focus.

Thus, everything you type is lost unless you explicitely click into the window once more before starting to type, which is very inconvenient and annoying.

@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 Jan 7, 2021
@zadjii-msft
Copy link
Member

Well that's weird. This was originally #179, which was tracked internally by MSFT:18715554. That bug (internally) is marked fixed, and that it should have shipped in 18934.1000.rs_prerelease.190702-1428. It also looks like this was cherry-picked back to 19H1.

Hmmm.

@zadjii-msft
Copy link
Member

For the record, I also can't repro this locally, on 10.0.20279.1003. It's entirely possible that code is being actively worked on so it may have regressed in 19041, and then been fixed again by 20279. I've reached out to the dev who fixed the original bug, maybe he's got more insight.

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Priority-3 A description (P3) Tracking-External This bug isn't resolved, but it's following an external workitem. labels Jan 8, 2021
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jan 28, 2021
@DHowett
Copy link
Member

DHowett commented Jan 28, 2021

-Triage on Tracking-External bugs.

@transentia
Copy link

transentia commented May 21, 2021

I believe that I am seeing this on:

Windows Terminal Preview
Version: 1.8.1032.0

Windows: 19042.985

The terminal opens, the cursor blinks but nothing is actually sent into the shell.

further: I THINK this causes another issue.

Open a terminal (say Ubuntu) via right-click and start typing. You THINK you are typing into the shell but (I guess it depends on what you type..) you end up with multiple terminal windows being opened.
(I can see this happen a lot, but I can't actively cause it. It MAY be a first-time-after-boot issue...)

Haven't found anyone else report this, so it may be just 'me' (or my poor search-fu)?

@HeinziAT
Copy link

HeinziAT commented Jul 9, 2021

Haven't found anyone else report this, so it may be just 'me' (or my poor search-fu)?

I can reliably reproduce this issue (Windows Terminal 1.8.1521.0, Windows 10 21H1 19043.1083).

This is especially annoying if you right-click to start an ssh session and then, after hitting Enter, you discover that you just entered your top-secret password "somewhere else".

Note: This seems suspiciously similar to this msrdp issue. In particular, focus still seems to be in the task bar, since typing "space" or "enter" will open another Windows Terminal instance.

@kishore-kal
Copy link

Windows Terminal Preview
Version: 1.9.1523.0

Edition: Windows 10 Home Single Language
Version: 21H1
OS build: 19043.1083

I was able to reproduce this issue with Windows Terminal and other apps (Firefox Developer Edition & Visual Studio Code)

Note: Highlighted category on the menu does not focus the window

Windows Terminal

terminal

Firefox Developer Edition

firefox

Visual Studio Code

vscode

@jacobseated
Copy link

jacobseated commented Jan 3, 2022

It seem to happen with a lot of apps, including Google Chrome.

Someone mentioned that Edge is causing it, and uninstalling it might fix it; but I am not interested in trying that, since I might need it for testing, and also, Windows Update will probably just forcefully re-install it against my will anyway.

OS build: 19044.1415

Edit: just attempted the "uninstall Edge fix", and restarted the system, but that did not solve it for me. The fix is discussed here: https://www.tenforums.com/browsers-email/161873-browser-edge-firefox-loses-focus-when-opening-through-taskbar.html

Edit 2: Manually updating to Windows 11 appears to solve the problem, but it totally breaks the taskbar functionality. No drag & drop, and no moving the taskbar to the left of the screen anymore — safe to say, Windows 11 got released on Desktop prematurely.

@zadjii-msft zadjii-msft removed the Needs-Tag-Fix Doesn't match tag requirements label Apr 19, 2022
@zadjii-msft
Copy link
Member

You know, is this still happening on Terminal 1.18 and Windows 11/? There's been an enormous amount of changes in both those codebases in the last 2.5 years since this was filed. I'm still fairly confident that this was ultimately a bug in the Taskbar's code. There's also been a tremendous process model refactor for the Terminal since then too.

There's also a similar thread (#13388) that seems like it mostly came down to some sort of 3p privilege management (namely, BeyondTrust) that would steal focus. That though shouldn't have started until 1.14 (long after this was filed).

There's also (tracked elsewhere) the well-known bug that starting WSLg will steal focus initially.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 21, 2023
@HeinziAT
Copy link

HeinziAT commented Aug 21, 2023

You know, is this still happening on Terminal 1.18 and Windows 11?

I cannot reproduce this issue any more (probably since upgrading to Windows 11 a few weeks ago). EDIT: Not true, see below.

@transentia
Copy link

I have:
Version: 1.18.1462.0
Windows: 2261.2134

image

If I select the "Windows PowerShell" entry, the terminal window appears and HAS focus.
"AlmaLinux9" appears but does NOT have focus until I click in the window. The window colour is the unfocused colour.

If I start "Windows PowerShell", then start "AlmaLinux9", Alma comes up in a new window which DOES have focus.

@transentia
Copy link

Hmmm.

If I start "Windows PowerShell", then take the focus away from the window (click on desktop) and then start "AlmaLinux9", Alma comes up in a new window which does NOT have focus.

@jacobseated
Copy link

jacobseated commented Aug 22, 2023 via email

@HeinziAT
Copy link

After trying it again, I can confirm transentia's observation: "Command Prompt" and "Powershell" keep focus, the behavior for WSL is... erratic: Yesterday, "Ubuntu" kept focus and my custom ssh profile lost focus, today it's the other way around.

@zadjii-msft
Copy link
Member

Okay, thanks for the follow-ups. That all sounds like the WSL focus thing (which itself is pretty erratic in my experience). We'll close this out on our side. I'm honestly not sure where the WSL thread is - I've looked for it for a while now but seemingly can't find the right one.

@zadjii-msft zadjii-msft closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2023
@zadjii-msft zadjii-msft added the Resolution-External For issues that are outside this codebase label Aug 22, 2023
@zadjii-msft
Copy link
Member

update: I'm told it's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Priority-3 A description (P3) Resolution-External For issues that are outside this codebase Tracking-External This bug isn't resolved, but it's following an external workitem.
Projects
None yet
Development

No branches or pull requests

7 participants