Repository navigation
Description
Search first
- I searched and no similar issues were found
What Happened?
Copy and Cut operations (via keyboard shortcut and context menu) are broken in Firefox.
No content is written to the clipboard, making Paste a no-op after Copy,
and Cut deletes the selection without saving it to the clipboard.
The following errors appear in the browser console:
-
XSLTProcessor.importStylesheet()throwsNS_ERROR_FAILURE (0x80600001).
Although Logseq has aparseerrorfallback in the XSLT path, the exception
is uncaught before reaching it. -
navigator.permissions.query({ name: 'clipboard-write' })throws a TypeError
because Firefox does not recognise'clipboard-write'as a validPermissionName.
This prevents execution from reachingclipboard.write()at all. -
Even when (2) is bypassed,
clipboard.write()fails with:
NotAllowedError: Type 'web application/logseq' not supported for write
because Firefox rejects non-standard MIME types inClipboardItem.
Firefox has also announced that XSLTProcessor will be removed entirely
in a future release: mozilla/standards-positions#1287
Workaround (paste into the browser console after page load):
(function () {
// Fix 1: Replace XSLTProcessor with a stub that returns a parseerror document,
// triggering Logseq's own fallback to the raw HTML string.
// Also future-proof against Firefox's planned removal of XSLTProcessor.
window.XSLTProcessor = class {
importStylesheet() {}
transformToDocument() {
return new DOMParser().parseFromString("<parsererror/>", "application/xml");
}
};
// Fix 2: Firefox does not recognise 'clipboard-write' as a valid PermissionName.
const _permQuery = navigator.permissions.query.bind(navigator.permissions);
navigator.permissions.query = function (desc) {
if (desc?.name === "clipboard-write" || desc?.name === "clipboard-read")
return Promise.resolve({ state: "granted", onchange: null });
return _permQuery(desc);
};
// Fix 3: Firefox rejects custom MIME types in ClipboardItem; fall back to writeText.
const _write = navigator.clipboard.write.bind(navigator.clipboard);
const _writeText = navigator.clipboard.writeText.bind(navigator.clipboard);
navigator.clipboard.write = async function (items) {
try { return await _write(items); } catch (_) {}
for (const type of ["text/plain", "text/html"]) {
for (const item of items) {
if (!item.types.includes(type)) continue;
try {
const text = await item.getType(type).then(b => b.text());
if (text) return await _writeText(text);
} catch (_) {}
}
}
};
})();With this workaround applied, Copy and Cut work correctly (content is written as text/plain).
Reproduce the Bug
- Open Logseq DB in Firefox (tested on Firefox 150.0.1).
- Open any page that contains blocks.
- Select one or more blocks.
- Press Ctrl+C (Copy) or use the context menu → Copy.
- Open a text editor outside Logseq and press Ctrl+V.
→ Nothing is pasted.
Alternatively:
4. Press Ctrl+X (Cut) or use the context menu → Cut.
→ The selection is deleted from Logseq, but nothing is available to paste.
Console errors observed (in order):
Uncaught NS_ERROR_FAILUREatXSLTProcessor.importStylesheet()(utils.js)TypeError: 'clipboard-write' is not a valid value for enumeration PermissionName(util.cljc)
Not reproducible in Chromium-based browsers.
Expected Behavior
Copy should write the selected block content to the system clipboard so that
it can be pasted both inside Logseq and in external applications.
Cut should do the same and additionally remove the selection from the document.
Both operations work correctly in Chromium. Firefox compatibility requires:
- Avoiding
XSLTProcessor(or guarding against its failure/absence), given
that Firefox is deprecating and planning to remove it entirely. - Not calling
navigator.permissions.query({ name: 'clipboard-write' }),
which is not a valid permission name in Firefox. - Avoiding non-standard MIME types (e.g.
application/logseq) inClipboardItem,
and falling back totext/plainortext/htmlwhenclipboard.write()fails.
Screenshots
No response
Files
No response
Browser, Desktop or Mobile Platform Information
Firefox 150.0.1
https://test.logseq.com/ (2026-06-04)
Additional Context
No response
Are you willing to submit a PR? If you know how to fix the bug.
- I'm willing to submit a PR (Thank you!)
Activity
yuxi-liu-wired commentedon Oct 27, 2026
Fixed in logseq/logseq#13892 (fix(clipboard): copy, cut and paste keep working when Firefox refuses a clipboard call). Its description has the cause and the test that pins it; it fails on current master and passes with the fix.
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…
fix(clipboard): copy in Firefox falls back to plain text when the Log…