Skip to content

Linux: native context menu runs action under mouse when opened #113175

Closed

Description

@thwaller

Issue Type: Bug

When I right click, the menu will flash on and then off almost immediately, like maybe 100 or 200 milliseconds. This is not all the time, but I am not able to narrow it down. It seems to be only in the editor that this issue exists. I can sometimes "fix" it by right clicking on the left side, like in the Explorer, then going back to the editor. I do not have this issue with any other software on my system. This started maybe Wed this last week, so approx around Dec 16th.

I removed 2 SCSS extensions which I believed were at fault, but with them uninstalled, the problem still exists. Those were my most recently installed extensions, the rest have been there a while.

Regarding what happens, when the right click menu disappears it seems like an option is being selected, almost like there is some sort of double click happening... the first right click to open the menu and a second to select something. I believe this to be the case as different things happen after I right click that normally require me to explicitely call said function.

VS Code version: Code - Insiders 1.53.0-insider (c927a80, 2020-12-18T05:27:50.274Z)
OS version: Linux x64 5.4.0-59-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz (8 x 2799)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 0, 0, 0
Memory (System) 31.32GB (0.37GB free)
Process Argv --no-sandbox --unity-launch --crash-reporter-id 99855e03-cc37-4ed5-907b-28a1bf4d8453
Screen Reader no
VM 0%
DESKTOP_SESSION mate
XDG_CURRENT_DESKTOP MATE
XDG_SESSION_DESKTOP mate
XDG_SESSION_TYPE x11
Extensions (68)
Extension Author (truncated) Version
html-snippets abu 0.2.1
scss-lint ada 0.1.10
project-manager ale 12.0.1
code-gnu-global aus 0.2.2
emojisense bie 0.8.0
markdown-checkbox bie 0.1.3
xml2json bui 1.2.4
npm-intellisense chr 1.3.1
path-intellisense chr 2.3.0
vscode-mysql-client2 cwe 2.8.6
vscode-markdownlint Dav 0.38.0
vscode-eslint dba 2.1.14
githistory don 0.6.14
xml Dot 2.5.1
gitlens eam 11.0.6
vscode-html-css ecm 1.2.1
vscode-npm-script eg2 0.3.13
apacheconf-snippets eim 1.3.0
git-project-manager fel 1.7.1
php-intellisense fel 2.3.14
vscode-firefox-debug fir 2.9.1
shell-format fox 7.0.1
vscode-pull-request-github Git 0.22.0
beautify Hoo 1.5.0
vscode-git-add-and-commit iva 2.1.1
search-node-modules jas 1.3.0
shortcut-menu-bar jer 1.5.0
vscode-gnupg-tool JHe 1.3.9
vscode-sshfs Kel 1.19.1
sftp lix 1.12.9
code-beautifier mic 2.3.3
xml-format mik 1.0.2
prettify-json moh 0.0.3
vscode-apache mrm 1.2.0
python ms- 2020.12.424452561
vscode-pylance ms- 2020.12.2
jupyter ms- 2020.12.414227025
cpptools ms- 1.1.3
debugger-for-chrome msj 4.12.11
sqltools mtx 0.23.0
vetur oct 0.31.3
java red 0.73.0
vscode-xml red 0.14.0
shellman Rem 4.7.0
live-sass rit 3.0.0
LiveServer rit 5.6.1
bash-debug rog 0.3.9
joplin-vscode-plugin rxl 0.3.0
bash-beautify sha 0.1.1
markdown-preview-enhanced shd 0.5.13
html5-boilerplate sid 1.1.1
sonarlint-vscode Son 1.19.0
code-spell-checker str 1.10.2
html-preview-vscode tht 0.2.5
shellcheck tim 0.12.2
vscodeintellicode Vis 1.2.10
vscode-java-debug vsc 0.30.0
vscode-java-dependency vsc 0.16.0
vscode-java-pack vsc 0.12.1
vscode-maven vsc 0.27.0
codetour vsl 0.0.42
gistfs vsl 0.1.12
nodejs-extension-pack wad 0.1.9
eno Wsc 2.3.41
JavaScriptSnippets xab 1.8.0
markdown-all-in-one yzh 3.4.0
html-css-class-completion Zig 1.20.0
ab-html-formatter zov 0.0.2

Activity

  1. sbatten commented on Dec 21, 2020

    @sbatten
    Member

    thwaller (@thwaller) what is almost certainly happening is that the menu is being drawn underneath the mouse cursor and that is activating the menu since the mouse up action triggers the item. we can't prevent that mouse up action from triggering as these are native menus, but we can try to fix the position (we already do try but there seems to be a consistent case you are hitting). if you could reproduce and take a short video, that would be helpful.

  2. thwaller commented on Dec 22, 2020

    @thwaller
    Author

    Please see a right click attempt that worked, then one that did not, then one that did in the video.

    Side note: I was disappointed to see that MKV files cannot be uploaded.

    EDIT: Before anyone comments, I have no issue with showing the credentials, they are only temp during this process.

    screen.mp4
  3. thwaller commented on Dec 28, 2020

    @thwaller
    Author

    Interesting. For me, I have tried what you suggest and attached a video of a series of right clicks at different lengths of time pressing the button down. For me, it did not seem to make a difference, it just changed how fast the menu disappeared. Also note that in this video you can see the mouse cursor is not moving, it is just a series of right clicks.

    screen.mp4
  4. added
    bugIssue identified by VS Code Team member as probable bug
    linuxIssues with VS Code on Linux
    menusMenu items and widget issues
    and removed
    info-neededIssue requires more information from poster
    on Jan 4, 2021
  5. sbatten commented on Jan 4, 2021

    @sbatten
    Member

    Robo (@deepak1556) if you get a chance, maybe you could help me with this some time. It seems even with the same coordinates on our side, the menu is sometimes still drawn under the cursor on linux and I am not sure we can do any more about it.

  6. yume-chan commented on Feb 7, 2021

    @yume-chan
    Contributor

    SteVen Batten (@sbatten) How about always using custom menus, but still allow title bar style to be switched between native and custom?

  7. bogdanbeniaminb commented on Feb 7, 2021

    @bogdanbeniaminb

    Yes, using custom menus does help, but it creates other issues for my workflow. One is that I can no longer hide the title bar, as I currently do with the native one (I'm using Linux/KDE). The other is that the menus are much, much larger, to a point where using them means scrolling through the list of options and this makes the workflow more difficult.

    I understand some have had this issue years ago as well (I found a github issue opened 4 years ago), but for me personally it only appeared in VSCode 1.53. I reverted back to 1.52 and it's working fine again. It seems to be something related either to the Electron version used in 1.53 or to VSCode itself.

    For me personally, using the "custom menus" workaround doesn't seem a solution. I would rather prefer this issue is investigated and fixed, as you would normally do with bugs.

    Thank you.

  8. thwaller commented on Feb 7, 2021

    @thwaller
    Author

    I understand some have had this issue years ago as well (I found a github issue opened 4 years ago), but for me personally it only appeared in VSCode 1.53. I reverted back to 1.52 and it's working fine again. It seems to be something related either to the Electron version used in 1.53 or to VSCode itself.

    I agree with this statement. This issue is "new" for me as well. There was a change somewhere that caused this issue, at least for some of us.

  9. IvanSafonov commented on Feb 7, 2021

    @IvanSafonov

    I have the same issue with VS Code 1.53. And it also works normal in 1.52.

    Version: 1.53.0
    Commit: 8490d3dde47c57ba65ec40dd192d014fd2113496
    Date: 2021-02-03T15:56:04.185Z
    Electron: 11.2.1
    Chrome: 87.0.4280.141
    Node.js: 12.18.3
    V8: 8.7.220.31-electron.0
    OS: Linux x64 5.4.0-65-generic
    
  10. 325 remaining items

  11. lukakostic commented on Dec 10, 2024

    @lukakostic

    Issue happening here too when using non 0 zoom level.
    Ubuntu, native window titleBar

  12. debianick commented on Jan 30, 2025

    @debianick

    kdeneon vscode 1.94.2 setting zoom to -0.1 or any value different than 0 fix it for me.

  13. pikomonde commented on Mar 20, 2025

    @pikomonde

    https://stackoverflow.com/questions/66419930/the-popup-menu-coming-on-right-click-disappears-instantly-in-vscode

    this stackoverflow method work for me, my system is ubuntu 22.04, hope help

    This one is working for me

    • Using Easystroke Gesture Recognition apps. Basically it adds delay in your "right click"
  14. Ige-fi commented on Mar 20, 2025

    @Ige-fi

    Since the upstream issue has been closed for months due to inactivity, I've created a new issue with a new reproduction Gist, using the same Electron version (34) that VS Code is using.

    electron/electron#46163

  15. podgorskiy commented on Mar 21, 2025

    @podgorskiy

    I can not emphasize how much this issue frustrates me. At work, many workflows depend on vscode, so I have to deal with it.
    Right-click does not work properly, I always accidentally click something on the right-click menu without knowing what I clicked.

    Stupid question. Can we show the right-click window on right right-click RELEASE and not PRESS, like all the other software does? Shouldn't this just resolve the issue?

    I'm sorry for the tone of the message. I would really want to give vscode a try, but I can not. Because right-click is totally messed up. I tried all these zoom-level tricks, but none seemed to work for me.

  16. mminot-yseop commented on Mar 21, 2025

    @mminot-yseop

    Can we show the right-click window on right right-click RELEASE and not PRESS, like all the other software does?

    Not really all softwares. I suspect this heavily depends on the OS and desktop manager. On Ubuntu+XFCE, it is on “press” for nearly everything. This can be seen as a feature (when the menu appears in the right place, of course…) because you can hold the mouse button down and release it on the menu item you’re interested in, therefore clicking once instead of twice. I know this sounds a bit silly but I actually like to do that from time to time.

    This leads me to an arguably cheap workaround suggestion: try to take the habit of holding the mouse button down when opening the context menu in VS Code, and release it only when you want, on the menu item you want, instead of letting this bug choose a random menu item for you. I used to do this before one of the suggestions from that thread (I think it was setting the “Title Bar Style” to “custom”?) fixed the issue for me. Dunno if you’ll like that, but it can make things less infuriating.

    Edit: And of course, try the “Title Bar Style” trick if you haven’t already. You mentioned zoom-based solutions, and I don’t quite remember if those are linked.

  17. synchro-- commented on Mar 21, 2025

    @synchro--

    Seriously just activate the native windows.

  18. podgorskiy commented on Mar 21, 2025

    @podgorskiy

    M. Minot (@mminot-yseop) , thank you! Setting the “Title Bar Style” to “custom” did the trick for me.

    try to take the habit of holding the mouse button down when opening the context menu in VS Code, and release it only when you want

    That's what I have been doing so far, but from time to time I forget about it and accidentally clicked something. But now it seems to work fine.

  19. Ige-fi commented on Mar 21, 2025

    @Ige-fi

    The window.titleBarStyle setting is not a universal fix for the problem, the problem just manifests in slightly different cursor/menu positions depending on your exact setup (zoom, window size, etc.). I'm on the latest version of Code, and I'm able to reproduce the problem on both window.titleBarStyle: "custom" and window.titleBarStyle: "native".

  20. deepak1556 commented on Sep 4, 2026

    @deepak1556
    Collaborator

    🤖 The root cause was an upstream Chromium bug in how native context menus were positioned on Linux. It was bisected and confirmed fixed in the Chromium runtime, shipping in Electron 35+. VS Code moved to Electron 37 in v1.103.0 (July 2025) and is currently on Electron 42, so the fix has been shipping for about a year now.

    Upstream tracking: electron/electron#46163.

    If anyone is still experiencing this on a recent VS Code version, please open a new issue with your system details — it would be a different bug at that point.

  21. added this to the 1.137.0 milestone on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugelectronIssues and items related to ElectronlinuxIssues with VS Code on LinuxmenusMenu items and widget issuessystem-context-menuIssue related to context menu drawn by the OSupstreamIssue identified as 'upstream' component related (exists outside of VS Code)upstream-issue-linkedThis is an upstream issue that has been reported upstreamverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions