microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.2k stars 28.85k forks source link

Editor: scroll jumps randomly (related to Chrome, Electron, xinput) #28795

Open mariusa opened 7 years ago

mariusa commented 7 years ago

Looks like VS Code is listening to mouse scroll events, even while it is not active in the window. Related: https://bugs.chromium.org/p/chromium/issues/detail?id=608246 https://bugs.chromium.org/p/chromium/issues/detail?id=807187

Steps to Reproduce requirements: Browser (Chromium / Firefox / Google Chrome), VSCode Editor (Any file type. Ideally a long file to ensure the scroll is visible.)

VSCode: Leave cursor at top of file. Browser: Scroll, excessively, (For a few seconds) down the page. Even if it's a blank tab with no content. VSCode: Scroll, ever so slightly, in any direction. You'll find the editor will jump suddenly further down the active file.

It seems VSCode is receiving the scroll events, for whatever reason; which are all suddenly evaluated upon any form of scroll input in the editor.

Updates based on comments

GUESS: Appears to be an issue with Electron and some input libraries? Is not isolated to VScode Fix: Does not yet exist.

Linux Workarounds (Not to be confused with a fix)

imwheel - not suitable for all users wayland - not suitable for all users Note: Ubuntu 19.04 (Desktop) appears to be using Wayland.

I'm not sure we will see further updates in here, which is a bit disappointing from the developers, given the amount of comments from affected people. I would like to have some official guidance, even if it's pointing us to other resources.

MattMcMurray commented 7 years ago
OS Ubuntu 16.04
VSCode Version 1.13.1

I'm getting a similar issue when Alt+Tabbing between windows. E.g., Alt+Tab to Chrome to read docs, etc., Alt+Tab back to VSCode, scroll up or down one click on the mousewheel, but the page scrolls down at least 3-4 pages pretty consistently.

UPDATE: Issue still present with all extensions disabled.

mariusa commented 7 years ago

This also happens with the right sidebar (Explorer) sometimes, when Alt+Tabbing between windows. Version: 1.14.2

dmblack commented 6 years ago

I've been experiencing this issue for a rather long time. I've never really put much thought into it, and it's not got worse; but I'm starting to really find this ever more frustrating. The actual impact to my productivity is beyond measure.

I'll find that this happens intermittently, but frequently - in which I'll attempt to scroll in the current file, and suddenly I'm scrolled to a location way out of bounds to the input. (Eg; I'm attempting to scroll a few lines, and suddenly I'm at the end of the file).

Some key thoughts may be;

I've deliberately left the version of Debian (Buster), and VSCode out of this note. I'm using latest of both, however this has most certainly been present for a long time.

I'll endeavor to provide further constructive input in attempts to discover where the problem lies, and attempt to pay more attention when it happens. @ramya-rao-a & @rebornix - I would expect this impacts a lot more users than reported here, hence tagging you here. Just a matter of how long before they too come to this level of frustration.

Edited; included additional information, tagged some people, and fixed some content.

mariusa commented 6 years ago

Same here, just couldn't find a way to reproduce it reliably. It is painful indeed. I don't use multiple workspaces, just alt tabbing between windows (also CTRL + P quick switching between files, but that doesn't seem to affect this). I use just mouse scroll, no touchpad.

tmtke commented 6 years ago

This is bugging me for quite some time, and I think I can reproduce it. It only happens (to me at least) if there is the mini search box at the top right corner of the editor. If I dismiss it, the scrolling disappears.

EDIT: I'm on Windows & OSX.

dmblack commented 6 years ago

@tmtke So you have definitely had this happen on Windows?

tmtke commented 6 years ago

@dmblack Yes, it happened on Windows.

tmtke commented 6 years ago

...damn, I think it's not that consistent. maybe a combination of the search box and the inline reference lines. I don't know nothing now :/

nise commented 6 years ago

I can confirm this behavior for Ubuntu 16.04, VC 1.18.1 if I switch between Chromium or Firefox back to VS Code. If switch back from Nautilus or Thunderbird for examples, everything works fine.

arenddeboer commented 6 years ago

I also experience this on Fedora 27 vscode Version 1.18.1

dmblack commented 6 years ago

I can finally, and consistently, reproduce. I can also confirm this not only impacts browsers like Chromium, Firefox, and Google Chrome, but other open applications. I can even have no applications open, only my Desktop visible, and reproduce.

For this example, simplified to ensure reliability; requirements: Browser (Chromium / Firefox / Google Chrome), VSCode Editor (Any file type. Ideally a long file to ensure the scroll is visible.)

  1. VSCode: Leave cursor at top of file.
  2. Browser: Scroll, excessively, (For a few seconds) down the page. Even if it's a blank tab with no content.
  3. VSCode: Scroll, ever so slightly, in any direction.

You'll find the editor will jump suddenly further down the active file.

It seems VSCode is receiving the scroll events, for whatever reason; which are all suddenly evaluated upon any form of scroll input in the editor.

@tmtke @mariusa Tagging you two, if you are able to please attempt to reproduce.

Something tells me this is actually an Electron bug. Unfortunately; I don't have any other Electron apps to test with.

Edit: I now have a Windows 10 box at home. Will endeavor to test and add results tonight.

vacantgeologist commented 6 years ago

I was also able to reproduce this issue with Ubuntu 16.04. It doesn't matter what app I switch to (tested with Chromium, gedit) although I wasn't able to reproduce by scrolling on an empty desktop. I am not experiencing this with Windows 7. I do not believe that it has anything to do with find or extensions, because when I boot code with --disable-extensions and don't use the find feature, the issue still occurs consistently.

Edit: I don't mean to imply that something is related without better testing, but the Electron/Atom team has a very similar issue that was reported to Atom: https://github.com/atom/atom/issues/15482 The description is nearly identical. There are some suggestions there about switching to Wayland, using editor in a different workspace, etc. I was able to confirm that putting VSCode in another workspace stopped the issue from happening. This looks like at least in my case it's not a VSCode-specific issue at the moment.

tranhl commented 6 years ago

As @dmblack surmises, it appears that this is an Electron bug. A related Atom issue has provided steps to reproduce the issue. It seems that Electron is receiving scroll events of Chromium applications that are on top of the Electron application and then replaying them after a scroll event on the Electron application.

Updating Electron seems to fix the issue though, so it's up to the vscode team to fix.

dmblack commented 6 years ago

@rebornix May we have your input (Tagging as it's assigned to yourself). Looks like this may be out of our hands otherwise.

Thanks all others involved so far!

tluanga34 commented 6 years ago

I'm having this issue. It's painful. VSCode is listening to mouse scroll event even while it is not active in the window.

tluanga34 commented 6 years ago

I came to learn that this is a bug from Chromium project and so affecting VScode for being based on electron which use Chrome engine under the hood.

I just filed a bug: https://bugs.chromium.org/p/chromium/issues/detail?id=807187

Not sure if they are taking this seriously.

arenddeboer commented 6 years ago

I wonder if this really is an Electron bug. The Atom editor does not have this issue, and the current Atom version (1.23.3 ) is using a much older version of Electron:

ares: "1.10.1-DEV"
atom-shell: "1.6.15"
chrome: "56.0.2924.87"
electron: "1.6.15"
http_parser: "2.7.0"
modules: "53"
node: "7.4.0"
openssl: "1.0.2j"
uv: "1.10.1"
v8 : "5.6.326.50"
zlib: "1.2.8"

vs code 1.19.3 :

ares: "1.10.1-DEV"
atom-shell: "1.7.9"
chrome: "58.0.3029.110"
electron: "1.7.9"
http_parser: "2.7.0"
microsoft-build: "1.7.9"
modules: "54"
node: "7.9.0"
openssl: "1.0.2k"
uv: "1.11.0"
v8: "5.8.283.38"
zlib: "1.2.11"

If this is an issue in Electron, I suspect much more users would be impacted. Is there a common extension or tool that triggers this behavior ? It still happens to me when running vs code with: code --disable-extensions but not when running vscode and chrome on a clean install, without any extensions installed.

I also use PlatformIO and wakatime as extenions, perhaps I should try to install my extensions one by one and see when the issue starts popping up.

Anyway, this is becoming such a productivity drag that I don't see another option short of switching editors. If anyone has found a workaround, please share.

update:

Fullpan commented 6 years ago

The issue is somehow related to libinput. As a workaround, you can replace the libinput with evdev, in ubuntu with xorg it's: "sudo apt remove xserver-xorg-input-libinput && sudo apt install xserver-xorg-input-evdev". But probably you will need to manually configure the mouse.

dmblack commented 6 years ago

@arenddeboer There's a link earlier in this thread in which Atom demonstrates same, or similar, symptoms - posted by @vacantgeologist and @tranhl

Regarding your 'scroll up' first notes; In my experience; the editor will scroll up or down, entirely depending on your behavior in other applications. As per my testing; I found that this was happening in any application, or even just my desktop - not just other 'Electron' applications.

Regarding a workaround; there are some notes, kindly clarified by @Fullpan. I have not tested them, however; I'd be interested in your experience/result if you give this a go. Please pay close attention to their note regarding potential manual configuration of your mouse.

@mariusa Could you please update the description / original information to include some additional information found by other users here. This will avoid other posts by users that may miss or misunderstand other content of this now much longer thread.

I'd encourage information or status updates by some of the appropriate developer stakeholders, but we do not seem to have much traction from them.

mariusa commented 6 years ago

@dmblack done @ramya-rao-a Would you please assign to a more responsive developer?

arenddeboer commented 6 years ago

@dmblack thanks for the feedback. @Fullpan thank you for the libinput / xorg reference. It made me realize I had WaylandEnable=false set in /etc/gdm/custom.conf. Switching back to Wayland solved the issue for me.

sebospc commented 6 years ago

The same here in manjaro gnome when I scroll in chrome and then I press alt+tab to vs code, the scroll put me the end. DISTRIB_RELEASE=17.1.2 kernel version 4.9.77-1-MANJARO version vs code 1.19.3 version libinput 1.9.4-1

bitc commented 6 years ago

This happens consistently when using synergy. It's very annoying. Relevant issue: https://github.com/symless/synergy-core/issues/6038

fentras commented 6 years ago

If you're using Ubuntu 17.10 with latest GNOME desktop environment you'll notice this bug too. I tried to install old Ubuntu DE "Unity" and use VSCode on it and I didn't noticed this bug. Everything worked as expected without any errors.

Linux 4.13, X11 with GNOME (not Wayland session)

Esteban-Rocha commented 6 years ago

Another victim of that bug here too, however I have been using zen mode and I'm getting a lower chance of that happening to me, also restarting chrome and VsCode seems in my case to help to "disconnect" the apps scroll events.

System is manjaro KDE plasma 5

haymez commented 6 years ago

This keeps happening to me too. Ubuntu Gnome 16.04. When I scroll in any application and then switch to either vscode or chrome it scrolls relative to whatever I scrolled in the other application. This is obviously very distracting. Anyone having any luck with the workarounds?

Bigghead commented 6 years ago

Super annoying problem. I'm now getting this problem in Antergos with GNOME.

I've had to put my main opened apps into their own separate workspaces and have a keyboard binding to flip between those.

Esteban-Rocha commented 6 years ago

Does anyone gets this error on zen mode? I'm been using it all the time and I had been 4 days without the issue, I don't know if this may be relevant but guess it couldn't hurt to look into it.

dnohales commented 6 years ago

FWIW, I can reproduce this issue in Chrome, VSCode and Atom (using Fedora). But only under X11.

bmewburn commented 6 years ago

I've experienced this for a while too. If I'm in another application for a while then switch back to vscode, the slightest tough on the touchpad or mouse wheel causes the editor to jump to a new position. I'm on Debian 9.

hardikdangar commented 6 years ago

I can confirm this issue happening on Ubuntu 17.10 on kernel version 4.15.8-041508-generic as well.

theFroh commented 6 years ago

I can confirm that this is still occurring for me on Ubuntu 18.04 LTS, VS Code Insiders:

Version 1.24.0-insider Commit 2404210629c744e6237a14d7b5fa852e24c6e898

(X11)

ezhimakov commented 6 years ago

Damn, it's very annoying bug, switching to browser, scroll something there, then back in VS, one scroll and voila! I'm at the bottom of my file.
Ubuntu 17.10

sevenryze commented 6 years ago

this annoying issue is occurring on ubuntu 18.04 LTS, and when i switch to wayland or use alt+f2 and r to reload gnome, it seems working good again. Maybe it's a workaround for you.

orkhanfarmanli commented 6 years ago

This needs to be fixed. It's annoying as hell.

theFroh commented 6 years ago

@sevenryze It definitely does not apply to Wayland. I'd totally jump ship to Wayland but I get poor performance, odd multi-monitor behaviour and non-existent NVIDIA driver support (for now!).

However, restarting GNOME most definitely does not have an effect.

I wonder; for anyone that is using VSCode (or Atom, or any Chromium/Electron based application) and not suffering from this bug; what desktop environment are you using?

As an aside, I believe using evdev instead of libinput (on X11) also avoids this issue.

orkhanfarmanli commented 6 years ago

I am using Ubuntu 16.04 with Gnome. None other electron app has this issue.

Bystroushaak commented 6 years ago

Confirming on Debian 9 / Mate.

dr0p commented 6 years ago

Lubuntu 18.04 user here - I also have some weird scroll behaviour on chrome based apps - slack, vscode, chrome itself. I do not get random scrolls, but rather those apps skip some scroll events. The funny thing here is that LXTerminal is also skipping scroll events. Firefox for example is working totally fine.. it is really annoying. Btw this mix of apps point to direction of the underlying infrastructure - on lubuntu 16.04 i did not had any issues, but after upgrade to 18.04 all hell broke loose..

fotonmoton commented 6 years ago

Same here on Xubuntu 18.04. But! Can reproduce only if I switch between VS Code and another window with alt+tab combination, if I switch via click on window on taskbar scroll doesn't jump.

nise commented 6 years ago

40 comments since June 2017 and still no solution? As a consequence I need to change my IDE.

Esteban-Rocha commented 6 years ago

@rebornix I'm not having the issue anymore since using zen mode, but is there a possibility to add this as a milestone or higher priority for next releases?

VSCode it's all great but this bug it's just too darn annoying, I understand there are a lot of issues and road maps are settled to take on improvements and bugs the best you guys can, and I'm petty happy overall on how you guys iterate on the editor, however I really think that this issue is not being given the needed importance as its a visual glitch that happens to break and seriously disturb the developers workflow.

This makes VSCode basically unusable because you cannot switch windows via alt+tab and that's a basic root functionality of the app.

fotonmoton commented 6 years ago

@Esteban-Rocha I can reproduce bug in Zen Mode.

smehrbrodt commented 6 years ago

Please stop spamming this bug. VSCode is open source, if you want it fixed, fix it! There is no value in adding comments demanding a fix from someone else.

orkhanfarmanli commented 6 years ago

@smehrbrodt We are creating awareness.

Esteban-Rocha commented 6 years ago

@smehrbrodt It's not spamming dude, you should first understand how OSS works and specifically how VS Code team works.

Esteban-Rocha commented 6 years ago

@fotonmoton Ohh that sucks :( ! I may be lucky then, if that's the case this means the issue it's even worst as there is no hack around it

theFroh commented 6 years ago

As an aside, I can confirm that Atom has resolved this issue for my setup since updating to Electron 2.0.0 (https://github.com/atom/atom/pull/17273). So, noting the work in https://github.com/Microsoft/vscode/issues/45542 I thought this may have also resolved this issue.

However I've tested for this bug on the exploratory builds from that issue and unfortunately it still appears to suffer from it.

edit: Scratch that, I was not testing Atom layered underneath another window; I was able to replicate it in Electron 2.0.0 powered Atom.

tluanga34 commented 6 years ago

My observation. The issue still exists with the google chrome so, it's hopeless to see it being fixed anytime soon in VS code.

dr0p commented 6 years ago

Okay.. from what I found out so far it looks like it has something to do with input coming from different virtual input devices. Installing and running imwheel without any additional configuration fixes the issue for all affected applications.