Skip to content
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

Firefox broke the clipboard polling with an annoying popup #301

Closed
trawn-88 opened this issue Apr 22, 2024 · 25 comments
Closed

Firefox broke the clipboard polling with an annoying popup #301

trawn-88 opened this issue Apr 22, 2024 · 25 comments
Labels
bug Something isn't working

Comments

@trawn-88
Copy link

When started in Firefox (Version 125.0.1) - every Mouse Click is a right click

image

Client OS: [e.g. Windows 11]

  • Xpra Server Version 5.0.8
  • Xpra Client Version 12

It works normal in older Versions

@trawn-88 trawn-88 added the bug Something isn't working label Apr 22, 2024
@totaam
Copy link
Collaborator

totaam commented Apr 22, 2024

I assume that you mean the xpra-html5 client since you said version 12.

Nothing has been changed when it comes to click handling for quite some time.
Which version did you have before that did not have this issue?

@trawn-88
Copy link
Author

Befor that, we had 8.1. It occours after the Firefox Update. With an older Version of Firefox, everything worked just fine. But after the update, you just have right clicks

@totaam totaam transferred this issue from Xpra-org/xpra Apr 22, 2024
@totaam
Copy link
Collaborator

totaam commented Apr 22, 2024

Please specify the exact Firefox versions that have / do not have this problem so that I can try to reproduce it.

@totaam
Copy link
Collaborator

totaam commented Apr 22, 2024

Tried it, left click works fine but Firefox seems to have added a new clipboard popup mis-feature.
Disable the clipboard to make this popup go away.
Same issue as Xpra-org/xpra#4194 (comment)

@trawn-88
Copy link
Author

trawn-88 commented Apr 23, 2024

I'm currently using Firefox 125.0.2 (new Version came up today) with XPra 5.0.8 and HTML5 Client 12

I have disabled the clipboard in default-settings.txt by adding clipboard=no. Unfortunately without success

@trawn-88
Copy link
Author

Is there any restriction, which Browser can be used? I couldn't find anything in the Documentary/Git Page

@totaam
Copy link
Collaborator

totaam commented Apr 23, 2024

There is no way to track which browsers / versions / platforms / OS / connection / server combinations work as there are just too many variables.
The documentation page would invariably be wrong and out of date as soon as it's written.

@totaam totaam changed the title Always RightClick under Firefox Firefox broke the clipboard polling with an annoying popup Apr 23, 2024
@gashtal
Copy link

gashtal commented May 5, 2024

@totaam Is this issue a "bug" in Firefox and needs to be solved by them, or can it be resolved from XPRA's side?

I finally managed to get the HTML5 client to work, only to discover I cannot actually use it because of this bug.

@totaam
Copy link
Collaborator

totaam commented May 5, 2024

@gashtal as per above, just disable the clipboard and things work fine with Firefox.
As for a fix, I will try to find a solution that lets us use the clipboard again without this seeing this pestering popup every time.

@gashtal
Copy link

gashtal commented May 5, 2024

@totaam Unfortunately, disabling clipboard is not an ideal solution as I heavily rely on clipboard sharing when using XPRA. I will go back to the OpenGL client and wait for this issue to be fixed in the HTML5 client. Thank you for all the time and effort you are putting into the HTML5 client.

@totaam
Copy link
Collaborator

totaam commented May 14, 2024

Originally recorded in #283 which is somewhat related.

What a mess!

Some links and notes:

  • See also: MDN: Browser Extensions: Interact with the clipboard
    • recommends using clipboard.setImageData for Firefox since it still doesn't implement Clipboard.write - sigh, but this is not available in plain Javascript: navigator.clipboard.setImageData = undefined
  • Document.execCommand (this API is so old that we might as well still support IE!!) with:
    • copy Firefox copies from a form element to the system clipboard, no permission problems.
    • paste does not work and returns false
  • The clipboard-write permission name is not currently supported in Firefox, only Chromium browsers. sigh
  • I've tried with clipboard-read for good measure on Firefox 125 and also got: Uncaught (in promise) TypeError: 'clipboard-read' (value of 'name' member of PermissionDescriptor) is not a valid value for enumeration PermissionName. because of course it doesn't support that one either, the MDN document also mentions a clipboardRead permission - this is for extensions only, same result anyway.
  • Despite being talked about in 2018 in An introduction to the new Async Clipboard API the clipboardchange event is still not implemented by any browsers - one good quote from this introduction: If you’ve ever tried to access the system clipboard, you know that doing so is usually an ugly combination of using multiple web APIs - you don't say, more true than ever 6 years later. The situation is still so bad that there are JS libraries to make it easier to copy to the system clipboard - and that's the easy part!
  • Firefox about:config tweaks / workarounds

caniuse: clipboard.read - looks like Firefox 128 will have better clipboard support? Though we may have to request the permission.

So, for now, either use a secure context or disable the clipboard?

@trawn-88
Copy link
Author

Hi @totaam
at first, thank you very much for the work you put in this! It's not your fault and still, you try to fix this. Somehow....

We already deactivated the Clipboard in the Firefox-Browser.
I'm going to get into the Information you delivered. But do i get this right, that you cannot fix this generally in a new Version?

@totaam
Copy link
Collaborator

totaam commented May 14, 2024

The commit above at least restores the clipboard copy from server to client, only client-to-server is disabled for Safari and Firefox.

There is now also a clipboard diagnostic page shipped with the client: https://github.com/Xpra-org/xpra-html5/blob/master/html5/clipboard.html

@trawn-88 I will be adding a button to the top bar so that users can trigger a clipboard copy to the server. Not user-friendly at all, but that's the best we can do with Firefox versions before 128.

totaam added a commit that referenced this issue May 14, 2024
@totaam
Copy link
Collaborator

totaam commented May 14, 2024

@trawn-88 please try the current version, it should look like this:

image

The copy icon on the right hand side of the top bar syncs the clipboard to the server explicitly.
(the copy from the server to the client should continue to work as before)

@trawn-88
Copy link
Author

I'll try as soon as possible and give you a Feedback

@gashtal
Copy link

gashtal commented May 27, 2024

@totaam Thank you for providing this work-around. I am currently trying to get it to work, but have not had much luck so far. As an example, I launch chrome with the following command:

xpra start :100 --bind-tcp=127.0.0.1:61111 --html=on --webcam=no --pulseaudio=no --start="google-chrome --force-dark-mode"

Then, I connect to the HTML5 session via browser, copy some text from the client, click on the "client to server" icon and the "Paste" button comes up. I click on the "Paste" button. At this point, if I open up a terminal and run xclip -o -selection CLIPBOARD, I do see the text printed in the terminal. However, I cannot paste the text into chrome by CTRL + V, and if I right click inside of chrome, the "Paste" option is greyed out. i.e. Chrome is not seeing the clipboard content at all. I seem to be able to paste that content in other applications, though, so it seems there is some limitation related to Chrome.

image

Regarding server to client which you mentioned should work as is, it doesn't seem to work for me regardless of which application I try to copy data from to the client.

P.S. I am running Ubuntu 22.04 on the sever.

@totaam
Copy link
Collaborator

totaam commented May 27, 2024

If you see the clipboard contents with xclip then the browser sync button is doing its thing and this should be filed as a separate issue.
As for server-to-client, please specify the full versions of the OS and Firefox, these workarounds are highly variant specific.

@gashtal
Copy link

gashtal commented May 27, 2024

Server: Ubuntu 22.04.04
Client: Firefox 126.0 on Windows 10

@totaam
Copy link
Collaborator

totaam commented May 27, 2024

@trawn-88 server to client worked for me on the very first attempt.

I copied some text on the server using xclip:

echo foo | xclip -i -selection CLIPBOARD

With clipboard debugging enabled I see this in the javascript console:

clipboard pending= false buffer= hello...
clipboard clipboard token received
clipboard targets= Array [ "UTF8_STRING" ]
clipboard target= UTF8_STRING is valid: true Utilities.js:811:30
clipboard dtype= UTF8_STRING dformat= 8 wire-encoding= Uint8Array(5) [ 98, 121, 116, 101, 115 ]
clipboard pending= true buffer= foo
clipboard click event, with pending clipboard datatype= utf8_string , buffer= foo
clipboard copy event, clipboard buffer= foo

And I can correctly paste foo into notepad++.

Note: you may need to click (anywhere on the page) to trigger the copy event.
Or just press the new clipboard button, which also synchronizes in this direction when there is a pending buffer.

Firefox 124 on Windows 10. Not using https.
Then I upgraded and re-tested with Firefox 126, same result.

@gashtal
Copy link

gashtal commented May 27, 2024

Can you kindly clarify how I can see the debug log when I enable clipboard debugging?

@totaam
Copy link
Collaborator

totaam commented May 27, 2024

Open the javascript console: Firefox Browser Console

@gashtal
Copy link

gashtal commented May 27, 2024

I am accessing the server through an Apache proxy. If I connect to the session by directly going to https://ip_address/xpra_path/, clipboard copy from server to client doesn't work, but if I go to https://ip_address/xpra_path/connect.html instead and explicitly connect to the same session from there using the default config, then it works. Looks like client configuration when I skip the connect page might not have server to client clipboard sharing enabled?

@totaam
Copy link
Collaborator

totaam commented May 27, 2024

If I connect to the session by directly...

@gashtal ah, now I see the problem too.
Not sure why that is yet.
I have added some logging in 74f0272 and the settings are the same..

@gashtal
Copy link

gashtal commented May 27, 2024

Hmm, maybe another Firefox bug, then? 😅

@totaam
Copy link
Collaborator

totaam commented Aug 28, 2024

FWIW: I can no longer reproduce the problem with Firefox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants