eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.1k stars 2.5k forks source link

Mouse-press event misfire in browser #14366

Open dannaf opened 1 month ago

dannaf commented 1 month ago

Bug Description:

In the browser, when I select text in the Editor via click-and-drag in a manner that the mouse button release at the end of the drag is released over the Explorer, this seems to inappropriately send a mouse-click event to the Explorer, which may result in one of the files in the Explorer seemingly-randomly opening in the Editor without user intention to do so.

(This is a very elusive bug that has bugged me for quite a while — I would often just see files from the workspace opening randomly in the Editor with no explanation — but I had trouble identifying it. Finally got some insight into what's going on...)

Steps to Reproduce:

  1. Launch the theia cloud demo in the browser; close the welcome screen and open the Explorer at the left side.
  2. Create a new file, say Untitled.txt, and type some text in it.
  3. Use the mouse to select the text in the direction from the right to the left via click-and-drag in a manner such that the mouse is released over the Explorer, over a different file (eg over README.md).
  4. Observe that README.md opens in the Editor, when the user merely intended to select some text (but went 'over' with the mouse outside of the Editor and into the Explorer, which may well happen with quick selecting during normal Editor use).

System info

msujew commented 4 weeks ago

FYI I noticed that in the web version of VS Code on FireFox as well. It might be a FireFox related issue. @dannaf Can you reproduce this on other browsers as well?

dannaf commented 4 weeks ago

Just tried in Brave, Chrome and Edge and did not see this reproduced. But I'd still be interested to know what's going on and what can be done on the theia end to eliminate or alleviate this.

JonasHelming commented 4 weeks ago

@dannaf Are you interested in debugging this?

dannaf commented 4 weeks ago

Not anytime soon.. I suppose I'll switch browsers in the meantime, now that I've finally understood a way to eliminate this bug by doing so, as it is very frustrating. (Previously I didn't know what could be done about it because I didn't know what's causing the bug in terms of the mouse movement, and hence also in terms of the browser dependence.)


One reason I encounter it so often is that I have an ipython terminal pane at the right side and I often select blocks of code coming with the mouse from the right, in order to copy-paste them into my ipython terminal, but then as I drag the mouse leftwards to select them I release it over the Explorer and I encounter this frustrating experience. Took a while to realize that this is what is going on, as I mentioned.

So the other thing I just did, before switching browsers, is set up a custom terminal profile and keyboard shortcut (shift+Enter) to run selected python text from the Editor in the ipython terminal, so that I won't have to click-and-drag to select the text as often. (Been meaning to do this for a while and this bug finally gave me the activation energy; see related issue I made to simplify this via the command palette https://github.com/eclipse-theia/theia/issues/14372.) It doesn't solve it 100% because I'll still sometime select code blocks with the mouse, but less as I can now also select and execute them with the keyboard, and I won't need to move the mouse over back and forth to paste even if I use it to select.

One small step for mankind, one huge step in convenience for me in my IDE. -:)