You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
Paste by using middle click in firefox not working #931
Since no one has linked to it already, here is the relevant bug within Firefox's Bugzilla. It looks like there are options that currently work in the developer edition of Firefox (I tried the first provided example, turned the <p> element into a <textarea> and the code worked). It appears that the FF team are still trying to make sure that the clipboard API standard gets nailed down first before this will get fixed in CodeMirror.
The bug in Firefox's Bugzilla linked to by frostyfrog was marked as resolved about a month ago, but the problem persists for codemirror. Any progress on this?
I'm annoyed by Jupyter not supporting middle-click paste just yesterday....There is no way to copy a value from output to the input without this feature when I've mapped Ctrl-C to interrupt the kernel instead.
The original FF issue has been resolved. Does this mean we can have this fixed? I'm using Jupyter, and middle click not working severely limits my productivity.
I'm still not seeing any paste events generated for middle clicks on uneditable elements in Firefox 59, so no, I guess the functionality we need to make this work still isn't there.
Hi @marijnh, I can middle click paste pretty much everywhere in FF on a wide range of websites. Could you be a bit more specific (sorry, I'm not a web developer). Maybe I could help test and narrow down the exact issue?
The thing that looks editable in CodeMirror isn't actually editable on the HTML level (it's static content, and focus is put on a hidden textarea), so Firefox doesn't understand that it should allow paste when this element is middle-clicked and doesn't generate the events necessary to access the clipboard.
See the inputStyle option, but that is unfortunately not very solid yet. There are plans to rewrite the library to work with contentEditable from the base up, which would sidestep such issues, but it's not clear yet how and when that will really happen.
This is a issue that's difficult if not impossible to solve with the fundamental approach currently taken by CodeMirror.
We are working on a rewrite (CodeMirror 6) that will address this issue, and we are currently raising money for this work: See the announcement for more information about the rewrite and a demo.
Note that CodeMirror 6 is by no means stable or usable in production, yet. It's highly unlikely that we pick up this issue for CodeMirror 5, though.
Hello there, I'm currently monkey-patching the codeMirror version we use in Firefox DevTools, and everything seems to work fine (using dispatchEvent instead of focusing the input on scroller's paste).
Could someone assign me the bug? I'll open a PR shortly.
I think this might need to be reopened; I can't middle-click to paste on any of the demos of the codemirror.net site with Firefox 76.0 on Ubuntu 19.10.
Perhaps worth noting that it does appear to work on the CM6 demo site.
And it pastes the clipboard selection, not the primary selection as native applications do.
Uh I remember wrong. It doesn't paste what I select in the CodeMirror editor; it does paste what I select outside the CodeMirror editor. (It works weird this way to me.)
Activity
marijnh commentedon Nov 7, 2012
This is a known issue 1. It doesn't seem to be solveable without patching Firefox.
lilydjwg commentedon Mar 16, 2015
Instead of patching Firefox, I guess an extension may work.
TheTechmage commentedon May 10, 2015
Since no one has linked to it already, here is the relevant bug within Firefox's Bugzilla. It looks like there are options that currently work in the developer edition of Firefox (I tried the first provided example, turned the <p> element into a <textarea> and the code worked). It appears that the FF team are still trying to make sure that the clipboard API standard gets nailed down first before this will get fixed in CodeMirror.
frabjous commentedon Mar 29, 2017
The bug in Firefox's Bugzilla linked to by frostyfrog was marked as resolved about a month ago, but the problem persists for codemirror. Any progress on this?
marijnh commentedon Mar 30, 2017
Not sure what they are supposed to have fixed there, but in Firefox nightly there's still no paste event for middle-click pasting.
frabjous commentedon May 3, 2017
The following minimal HTML will fire the onpaste event in Firefox 55 (linux) with a middle click:
It also works on textareas, etc., even without the contenteditable attribute.
I can't figure out how to make that work for codeMirror, however, if it is possible.
frabjous commentedon Oct 25, 2017
Middle click works fine to paste in Firefox with the similar EditArea javascript editor -- Example here. How did they manage it?
lilydjwg commentedon Oct 26, 2017
@frabjous it's a big textarea, with all normal features like GTK editing keys available. The colorful text is laid under it.
It doesn't support multiple selections however.
nthiery commentedon Jan 17, 2018
A fix would be most welcome, e.g. for our teaching with Jupyter under linux.
Thanks in advance!
lilydjwg commentedon Jan 17, 2018
I'm annoyed by Jupyter not supporting middle-click paste just yesterday....There is no way to copy a value from output to the input without this feature when I've mapped Ctrl-C to interrupt the kernel instead.
simcop2387 commentedon May 8, 2018
Wanted to chime in that there's also a related Firefox bug ticket open about this issue too. https://bugzilla.mozilla.org/show_bug.cgi?id=953389
suvayu commentedon May 10, 2018
The original FF issue has been resolved. Does this mean we can have this fixed? I'm using Jupyter, and middle click not working severely limits my productivity.
marijnh commentedon May 11, 2018
I'm still not seeing any paste events generated for middle clicks on uneditable elements in Firefox 59, so no, I guess the functionality we need to make this work still isn't there.
suvayu commentedon May 11, 2018
Hi @marijnh, I can middle click paste pretty much everywhere in FF on a wide range of websites. Could you be a bit more specific (sorry, I'm not a web developer). Maybe I could help test and narrow down the exact issue?
PS: the latest release is FF 60.
marijnh commentedon May 12, 2018
The thing that looks editable in CodeMirror isn't actually editable on the HTML level (it's static content, and focus is put on a hidden textarea), so Firefox doesn't understand that it should allow paste when this element is middle-clicked and doesn't generate the events necessary to access the clipboard.
7 remaining items
marijnh commentedon May 15, 2018
See the
inputStyleoption, but that is unfortunately not very solid yet. There are plans to rewrite the library to work with contentEditable from the base up, which would sidestep such issues, but it's not clear yet how and when that will really happen.adrianheine commentedon Sep 6, 2018
This is a issue that's difficult if not impossible to solve with the fundamental approach currently taken by CodeMirror.
We are working on a rewrite (CodeMirror 6) that will address this issue, and we are currently raising money for this work: See the announcement for more information about the rewrite and a demo.
Note that CodeMirror 6 is by no means stable or usable in production, yet. It's highly unlikely that we pick up this issue for CodeMirror 5, though.
nchevobbe commentedon Jan 18, 2019
Hello there, I'm currently monkey-patching the codeMirror version we use in Firefox DevTools, and everything seems to work fine (using
dispatchEventinstead of focusing the input on scroller'spaste).Could someone assign me the bug? I'll open a PR shortly.
marijnh commentedon Jan 18, 2019
Apparently not, github won't let me assign this to you (I guess you can only assign team members?). But don't let that stop you!
nchevobbe commentedon Jan 18, 2019
marijnh commentedon Jan 22, 2019
This was finally fixed in #5751 (but see also #5754 )
cu commentedon May 14, 2020
I think this might need to be reopened; I can't middle-click to paste on any of the demos of the codemirror.net site with Firefox 76.0 on Ubuntu 19.10.
Perhaps worth noting that it does appear to work on the CM6 demo site.
marijnh commentedon May 14, 2020
It still works for me (Firefox 75 and 76 on Debian)...
dmitry-at-publons commentedon May 14, 2020
Trying demos on codemirror.net with Firefox 76.0.1 on Ubuntu 18.04: can paste, but can't copy by selecting or double clicking.
Same behaviour on https://codemirror.net/6/.
lilydjwg commentedon May 15, 2020
And it pastes the clipboard selection, not the primary selection as native applications do.Uh I remember wrong. It doesn't paste what I select in the CodeMirror editor; it does paste what I select outside the CodeMirror editor. (It works weird this way to me.)
nchevobbe commentedon May 15, 2020
Yes, this is a known issue on the Firefox side: https://bugzilla.mozilla.org/show_bug.cgi?id=1593761