Bug 465252

Summary: Disabling "middle-click paste" breaks pasting URL from Firefox to other apps
Product: [Plasma] kwin Reporter: tustamido
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: kde, kde, xnaxdy
Priority: NOR    
Version: 5.26.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.27
Sentry Crash Report:

Description tustamido 2023-02-04 05:03:37 UTC
STEPS TO REPRODUCE
1. System Settings → General Behavior → uncheck "Middle click: Paste selected text" and click Apply.
2. Log out and log in again, still on Wayland. Or reboot.
3. Make sure you're running Firefox Wayland. To check, open about:support, and look for "Window Protocol", the value should be "wayland", not "xwayland".
4. Copy any text from urlbar and try to paste it on any other app, like Kate.

It doesn't work, nothing is pasted.

More info:
- This is not a Firefox regression. The issue started a couple of weeks ago, but if I run an older Firefox version, like v105, the issue is still present.
- It doesn't affect Firefox as a whole. Since the bug started, I quickly found a way to paste urlbar content to other apps: pasting on Firefox works, just on other apps that does not, so first I press Ctrl+F to open Firefox findbar, then Ctrl+V to paste the URL in there, then Ctrl+A to select all finally Ctrl+C to copy again. This way I cant paste on any app, which means other Firefox text boxes like find bar aren't affected, only titlebar (from the text boxes I tested).
- This is Wayland specific. If you start Firefox with Xwayland (MOZ_ENABLE_WAYLAND=0), the issue is gone.
- As you can guess from steps to reproduce, the issue seems to be related to the Plasma code to disable pasting with middleclick. If you keep the option checked in General Behavior and log out from the session to apply (restarting Firefox is not enough), the issue is gone. But I disabled middleclick pasting months ago, right when it became available, and at the time there was no such issue. So it's some "new" code, not from when disabling middleclick paste was first implemented.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8
Comment 1 tustamido 2023-02-04 05:05:47 UTC
From previous comment: "which means other Firefox text boxes like find bar aren't affected, only titlebar"

I meant "only urlbar", sorry.
Comment 2 David Edmundson 2023-02-04 13:39:45 UTC
This should be addressed in 5.27
Comment 3 Naxdy 2023-02-17 11:51:24 UTC
Still an issue in current 5.27 (Gentoo Packages)
Comment 4 tustamido 2023-02-17 13:18:05 UTC
Yes, not fixed, still an issue in 5.27 (Tumbleweed).
Comment 5 Vlad Zahorodnii 2023-02-20 10:25:57 UTC
In 5.27, we changed how primary selection is disabled. If you restart the computer, kwin won't advertise support for primary selection.

If copy paste breaks in the url bar after disabling primary selection, we're pretty sure that it's a client (firefox) bug. Please report this issue to Firefox developers.

As one step further, I used kwin's debug console to analyze firefox's selection. When you press Ctrl-C, FF seems to set a selection, but it's empty, it does not contain the url.
Comment 6 Dragoon Aethis 2023-04-17 19:19:56 UTC
Relevant downstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1791417