most of the time I do an Alt+Tab (switch windows), go from browser (chrome) to Visual Code and vice versa, mouse scrolling misbehaves, it jumps to somewhere in the page, either way down the current scroll position, or way up, any thoughts on what's going on?
Installing and running
imwheel
fixes the problem for me.You have to start it at every boot (or add it at the applications to start).
pgrep -lf imwheel
to see if it's running ; you can stop it withpkill imwheel
./!\ It disables the zoom by
Ctrl + wheel
in applications (Firefox, Chromium, LibreOffice, PDF reader...)(Maybe a setting in imwheelrc could fix that)
If you are asking for a solution, It's still an unsolved bug. But if you wonder why such a thing may happen, I think the reason is that scroll position is being unique for all windows, or it's being changed for all of them when you scroll. for example, if you scroll up in a window a little, then go to the other one and start scrolling, the bar jumps a little upper and starts moving from there, showing that scroll changes from the other tab are being applied to the new one too.
I solved this problem by logging in with configuration Ubuntu on Wayland instead of simply Ubuntu. Something like that. Image quality is low but you'll get the point.
That means I use Wayland instead of xorg but changing file /etc/gdm3/custom.config does not seem to solve the problem as stated here.
If you are not too attached to GNOME, switching to Unity solves the scroll issue on the mouse & trackpad:
Source: https://itsfoss.com/use-unity-ubuntu-17-10/#:~:text=Switch%20from%20GNOME%20to%20Unity%20in%20Ubuntu%2017.10,option%20to%20switch%20to%20Unity
To restore the natural scrolling and other trackpad features, also install synaptics drivers: