-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag and drop does not work in Wayland #156723
Comments
I'm seeing the same (no drag&drop of any elements) on https://vscode.dev/ running in Chrome 103.0.5060.134 with Preferred Ozone platform set to wayland (same reason, need it for scaling). |
Same. I am using Linux+sway and I am having the exact same issue since 1.69. I can reorder tabs without any problem after downgrading to 1.68. Related issue: #83568 |
I thought it must relate to #154693, labeled as |
It's clearly related to the switch to electron18 in the last versions, using the latest release but switching the electron binary to electron17 works just fine for me |
It also effects vscode.dev which runs in the browser rather than electron? So I guess it is an issue with newer versions of Chromium. |
Can you briefly explain how you run it with electron17? I tried to just set the version to latest 17 in the package.json but the build failed. |
For what it's worth, I can also reproduce this bug (on sway) but only when the title bar style setting is set to |
Thank you very much this solved my problem! |
+1 on this issue. Although @vially's workaround works, it would be great if native title bars could be fixed as it's not ideal to have to work around this in a WM configured without title bars.
|
+1 on this. Drag-n-drop a file into vscode is currently a hit or miss on my machine. Sometimes it works, sometimes it gives out no response, sometimes it gives out a file not found error. VS Code Version: 1.70.2 |
Using an electron binary (electron20 from official archlinux repository) i tried
and it launched VSCode (with a few errors regarding native modules not compiled against Runs successfully under wayland and drag-and-drop seems to work. But |
For me with the official build, drag&drop works mostly fine, except for certain operations. Drag & drop selection = OK |
Currently, I'm using
|
You can directly run the original VSCode executable instead of the wrapper script provided by Arch to run VSCode without arguments. |
Could someone confirm if this does still repro with the most recent electron version? I've just learned that obsidian pane/tab dnd got fixed after upgrading it to 1.7.5 electron 32 (using Arch package), so I wonder if that works for vscode as well. If not, I'd suggest filing an upstream bug at https://issues.chromium.org/new and cc me on it ([email protected]). Thanks |
@nickdiego I am using code oss from Arch Linux repo, and I can confirm that this issue still exists. |
@nickdiego still happening on Fedora 41 with the Microsoft RPM. My workaround is to start without the ozone flags (i.e. use X11), drag my panes around, then restart with the flags. Without using ozone on a fractionally scaled display the X11 rendering produces blurry fonts. |
The latest version seems broken, I'm getting this crash (bt bellow) when clicking on the main window:
(which means electron 32 needs to be updated, specifically it lacks this chromium patch).
I've just tested on my local Arch box with latest official vscode 1.95.1 (using @visual-studio-code-bin AUR) on both Gnome Shell 47 and Sway 1.10 and see no issue. At least when reordering and rearranging tabs into new panels, etc, as can be seen in the attached screencast. Screencast.From.2024-11-06.15-17-22.mp4 |
@nickdiego similar setup - arch on KDE with wayland, using the visual-studio-code-bin from AUR 1.95.1. Unfortunately, reordering tabs worked since quite a while - what doesn't work is reordering the side-pane buttons (files / vsc / ...), or reordering the tabs in the bottom menu (e.g. switch terminal and debug console around). It's not crashing immediately - but does core-dump and "hangs" (no further ui interaction possible) until i kill the code instance. |
Most of the dragging operations seem to work. However, one thing that seems to consistently fail is dragging an item from the main activity bar to the right sidebar. 2024-11-06.mp4 |
@vially can you try reordering the items in the activity bar (instead of dropping them to the right sidebar) ? (that's what's failing me ... and bothering me the most) |
@xmatthias Nope, reordering items in the activity bar does not seem to work either. reorder-items.mp4 |
Oh, ok. Thanks all for clarifying! I can reproduce it even with https://vscode.dev using chrome's wayland backend, which is rather not reproducible with the X11 backend (even through XWayland). That likely indicates an upstream chromium issue. I'll look into it! |
OK, I've figured out the root issue: It seems no data/type is being set for those draggable items, as explained in [1], which leads to no mime types being offered and accepted at Wayland protocol level. As can be seen in this wayland debug log excerpt (collected upon drop event):
That leads to the dnd session to fail (cancelled) which is why the visual item does not get moved. Quoted below is what the Wayland protocol says about it:
Further context at https://wayland.app/protocols/wayland#wl_data_offer:request:accept Thus, it must be fixed at app level (ie: vscode), by associating data and type to those draggable items. [1] https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API#the_basics |
After digging into it a bit more and considering that W3C dnd spec does not mandate drag data to be necessarily assigned by the application, I believe that's something we must address at chromium level. It's being tracked under https://issues.chromium.org/377760837. The wip fix is under review here and will hopefully land soon. thanks |
Even though the Wayland spec says that dnd sessions with no accepted mime type should always end as cancelled [1], W3C's counterpart does not enforce such behavior [2]. In order to ensure compatibility for web apps already relying on such behavior, this CL uses a placeholder mime type to make it possible for outgoing drag-and-drop sessions with empty mime types list (not set by the application) to end successfully. The minimal sample at [3] was used to validate it, in addition to vscode.dev web app, by rearranging its left-side bar action items. Refer to linked crbug and comments at [4] for further repro steps and expectations. [1] https://wayland.app/protocols/wayland#wl_data_offer:request:accept. [2] https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#drag_data [3] https://people.igalia.com/nickdiego/samples/dnd-empty-drag-data/ [4] microsoft/vscode#156723 (comment) [email protected], thomasanderson Bug: 377760837 Test: Manually, by rearranging left side bar items of https://vscode.dev and the minimal sample at [3]. Change-Id: I3fd5dd2ab9a9f3482334371af35bde554fd3d1a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6000277 Commit-Queue: Nick Yamane <[email protected]> Reviewed-by: Orko Garai <[email protected]> Cr-Commit-Position: refs/heads/main@{#1380008}
The fix has landed upstream chromium yesterday and started shipping in version 132.0.6826.0 (canary channel). Please test and report back, I didn't test it on KDE, for example. Feel free to ping me over mail or matrix if needed. thanks! |
@nickdiego thanks a lot for taking the time to investigate and address this issue! I will test change in Electron and backport it to our release lines. EDIT: verified the fix and backported at electron/electron#44753 |
Tested on a Framework 13 laptop, NixOS with Plasma (wayland) desktop. I launched insiders with |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
--enable-features=UseOzonePlatform --ozone-platform=wayland
to code-flags.confI am unable to re-order windows, create multiple panes with drag and drop, etc
It works if I do not add the flags. The issue is I need the flags for scaling in Wayland.
The text was updated successfully, but these errors were encountered: