question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Focus is repeatedly stolen from terminal

See original GitHub issue

Reposted from https://github.com/microsoft/vscode/issues/125800

Issue Type: Bug

  1. Open dotnet/winforms project
  2. Click on the terminal tab
  3. Repeat step 2

https://user-images.githubusercontent.com/2119212/121288205-fd09a880-c8b0-11eb-848b-7cc668a30f70.mov

VS Code version: Code 1.56.2 (054a9295330880ed74ceaedda236253b4f39a335, 2021-05-12T17:44:30.902Z) OS version: Darwin x64 19.6.0

System Info
Item Value
CPUs Intel® Core™ i7-4870HQ CPU @ 2.50GHz (8 x 2500)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 3
Memory (System) 16.00GB (0.71GB free)
Process Argv –crash-reporter-id 1fc67ee2-0174-4598-9f98-4537df0dd32c
Screen Reader no
VM 0%
Extensions (55)
Extension Author (truncated) Version
vscode-bazel Baz 0.4.1
LinkCheckMD bla 0.3.1
open-in-macdown Cod 1.0.0
vscode-zonefile Com 0.0.4
vscode-markdownlint Dav 0.42.0
jshint dba 0.11.0
vscode-eslint dba 2.1.20
dhall-lang dha 0.0.4
docs-article-templates doc 0.2.11
docs-authoring-pack doc 0.1.13
docs-images doc 0.0.9
docs-linting doc 0.0.7
docs-markdown doc 0.2.94
docs-metadata doc 1.0.6
docs-preview doc 0.3.57
docs-scaffolding doc 0.0.8
docs-yaml doc 0.2.6
EditorConfig Edi 0.16.4
prettier-vscode esb 6.4.0
go gol 0.25.1
terraform has 2.12.0
haskell has 1.4.0
hive-sql jos 0.0.4
language-haskell jus 3.4.0
vscode-sbt-scala lig 0.2.4
autoconf mae 0.1.0
hg mrc 1.7.1
vscode-docker ms- 1.13.0
csharp ms- 1.23.12
vscode-kubernetes-tools ms- 1.3.3
vscode-postgresql ms- 0.3.0
python ms- 2021.5.842923320
vscode-pylance ms- 2021.6.0
jupyter ms- 2021.6.832593372
cmake-tools ms- 1.7.3
cpptools ms- 1.4.1
powershell ms- 2021.5.1
vscode-typescript-tslint-plugin ms- 1.3.3
fabric8-analytics red 0.3.3
java red 0.79.2
vscode-commons red 0.0.6
vscode-xml red 0.16.1
vscode-yaml red 0.19.2
preview-vscode sea 2.2.5
code-spell-checker str 1.10.2
html-preview-vscode tht 0.2.5
simple-rst tro 1.0.1
cmake twx 0.0.17
vscodeintellicode Vis 1.2.14
vscode-java-debug vsc 0.34.0
vscode-java-dependency vsc 0.18.4
vscode-java-pack vsc 0.16.0
vscode-java-test vsc 0.30.0
vscode-maven vsc 0.31.0
markdown-all-in-one yzh 3.4.0
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt639:30300192
pythontb:30283811
pythonvspyt551:30311712
vspre833:30267464
pythonptprofiler:30281270
vshan820:30294714
pythondataviewer:30285071
vscus158:30286553
pythonvsuse255cf:30311221
vscgsv2:30307504
vscorehov:30309549
vscod805cf:30301675
binariesv517:30312825

Environment data

dotnet --info output: VS Code version: C# Extension version:

Host (useful for support): Version: 5.0.6 Commit: 478b2f8c0e

.NET SDKs installed: 5.0.300 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download

OmniSharp log

Steps to reproduce

Open a clone of dotnet/winforms Open a terminal tab Try to use it

Expected behavior

Focus should not be repeatedly stolen

Actual behavior

Focus is repeatedly stolen.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
justinmchasecommented, Feb 8, 2022

Most of the time this is a very useful behavior…

@JoeRobich I’m sorry I must disagree. Stealing focus like this is a major UX violation and it is really an inappropriate way to handle errors in this case. There is no error that this plugin can produce that will ever warrant changing the users focus and there is no possible way for you to solve this bug in a way that will gracefully switch the users focus. It is a bug to steal the focus unless a direct user action has directed you to do so.

In the case where an error like this issue is encountered, you can use one of the non-focus stealing UI mechanisms to notify the user, such as popping up the toast alert message or perhaps an inline error in the code file or perhaps the color of the alert bar on the bottom or maybe a adding an error notification in a problem panel… There are numerous ways to notify the user when an unrecoverable error has been encountered without altering the users focus. This plugin, like every other plugin, must not alter the users focus unless the user has specifically instructed you to do so with a direct action (click a button, keyboard shortcut, command pallete, whatever).

Wikipedia identifies this behavior as an error state https://en.wikipedia.org/wiki/Focus_stealing

A classic opinion piece: https://blog.codinghorror.com/please-dont-steal-my-focus/

Mozilla considers focus stealing a category of bug: https://bugzilla.mozilla.org/buglist.cgi?quicksearch=focus+stealing

3reactions
JoeRobichcommented, Jun 11, 2021

@jsoref Most of the time this is a very useful behavior. When errors are reported it typically means that OmniSharp will be unable to provide language services, so getting that information to the user so they can resolve the reported issue is the right thing to do. This particular error is an unfortunate case because it will be reported for each project in the workspace until project loading is complete.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Focus is repeatedly stolen from terminal #125800 - GitHub
Focus is repeatedly stolen from terminal #125800 ... Open dotnet/winforms project; Click on the terminal tab; Repeat step 2.
Read more >
When Terminal forks process, current app loses focus
This fix applies to both Failsafe and Surefire (although in my case, Surefire wasn't stealing focus). In your pom.xml , add a <argLine>-Djava.awt.headless=true< ......
Read more >
How to prevent new windows from stealing focus? - Ask Ubuntu
Install CompizConfig Settings Manager. either from Ubuntu Software Center. or via terminal: sudo apt-get install compizconfig-settings-manager.
Read more >
Focus stealing - LWN.net
With 2.11.90 it still happens. Easy example: type "gnome-terminal &" in a terminal emulator in the lower right corner. The new terminal window ......
Read more >
X11/Emacs constantly stealing focus, driving me crazy
run in other spaces. Whenever I have a remote emacs window open in X11, I find that X11 steals focus (and changes the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found