Repository navigation
Fix middle-click paste on Firefox. - #5751
Conversation
The current solution consists in focusing the input when the scroll container capture a paste event, which does not work on Firefox. In order to fix this, creating a new paste event, copying the clipboardData and dispatching it on the textarea seems to do the trick. This works on Firefox 64, with the config set to true.
|
I'm only able to test this on OSX with Firefox (using the MiddleClick software to have a true middle-click). I did not find a way to enable middle-click paste on Chrone on OSX. I would be interested to know if everything is okay in other browser and platforms. |
|
Did you test whether this breaks middle-click paste on Chrome? There |
|
Unfortunately, this works neither in Chrome nor on Firefox for me (using Linux) |
Yeah, I was just being cautious for old-browser support. |
:/ , I'm positive it should work on Firefox (maybe only Nightly for Linux, but I doubt it). Okay, time to boot-up my VM. |
|
I'm testing with Firefox 64.0.2 |
|
Hello Martin, I put up a page to test this PR : https://codemirror-firefox-middle-click.glitch.me/ It's working for me on:
I'm currently upgrading my Ubuntu VM in order to test Firefox 64 on it. Could you tell me if:
Thanks! |
|
Verified it also works on:
|
|
I can't see the page you put up (there's no link), but retrying the patch, I can see Firefox work now. Chrome (71.0.3578.98) still doesn't do anything when I middle click on an editor. |
|
Same problem. Though I did notice that middle-click paste on Chrome works when the editor is unfocused, but not when it has focus. |
worst case, I could use the
That's a lead, I'll check this. |
|
One silly question: does it works for you on Chrome without this patch? (it does on my machine on https://codemirror.net/demo/simplemode.html) |
|
Not a silly question at all, it seems! It doesn't, and in fact old versions also no longer work, so I guess something in Chrome changed that broke the existing kludge. Interesting that no one seems to have complained about it yet. Given that, I guess it'd be a good idea to drop the focus kludge code entirely, since it won't be firing or working anywhere. |
|
Could this be somehow OS specific? What distrib+version are you testing on? (As stated before, it does work for me on Chromium, on Ubuntu, both with and without my patch) |
|
Maybe. I'm using Debian 9.6. Are you able to test with Google's Chrome packages? |
|
It's working for me, both with and without my patch on Google Chrome 71.0.3578.98 (Official Build) (64-bit) I'm going to grab a Debian image and check everything there. |
|
I guess it's more likely to be a strange local issue, at this point. I'm spinning up another Debian machine to see if it's better there. |
|
Hm, nope, same problem in Chrome 69 there. |
|
(And by 'same issue' I mean that it doesn't work at all before your patch, and only works when unfocused with the patch, so the patch still is an improvement.) |
|
Okay, so on Debian it's working for Firefox, and for Chromium, but only if unfocused (same as you basically). I can see the textarea |
|
Yes, I think that's reasonable. Thanks for figuring out this workaround for Firefox! |
|
Thanks for helping me figuring this out @marijnh :) |
|
I've just tried https://codemirror-firefox-middle-click.glitch.me/: Firefox 64.0 at Ubuntu 18.04: pasting works, but copying text from a form (selecting with a mouse or double-clicking) does not. Chromium 71 at Ubuntu 18.04: everything works |
The current solution consists in focusing the
input when the scroll container capture a paste
event, which does not work on Firefox.
In order to fix this, creating a new paste event,
copying the clipboardData and dispatching it
on the textarea seems to do the trick.
This works on Firefox 64, with the
config set to true.