microsoft / vscode

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

Clicking inside editor and releasing the mouse button on a link outside activates the link (web/monaco) #199477

Open ThiefMaster opened 1 year ago

ThiefMaster commented 1 year ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Go to vscode.dev
  2. Open an editor
  3. Click somewhere in the editor (e.g. to select a bunch of text) and keep the mouse button pressed
  4. Move the mouse pointer over something outside the editor, e.g. the "Read the announcement" header
  5. Release the mouse button

Nothing should happen since links/buttons are not supposed to trigger just because you release the mouse button while hovering them. After all, the click did not target that link/button.

FWIW this but is VERY annoying when embedding monaco-editor on a webapp that has a navigation near the editor's left side. When selecting a block of I almost always end up with the cursor on the menu and thus leave the page...

alexdima commented 12 months ago

@ThiefMaster Would you be interested in trying to provide a PR? I think an e.preventDefault() could do the trick. Perhaps somewhere in here or around -- https://github.com/microsoft/vscode/blob/a28e68ad708091722507a7f54eaf61e1905c172c/src/vs/editor/browser/controller/mouseHandler.ts#L465-L477

flyyuan commented 10 months ago

@alexdima can I take this one or is someone else working on it?