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 }}
Repository navigation
Firefox: Triple click + Ctrl+c in code block copies two lines instead of one #10495
I have read the console error message carefully (if applicable).
Description
On Mozilla Firefox when selecting a line in the code block using a triple click, it selects it fine. But if you copy it, it copies both the line you selected and one line above. This is really annoying when copy&pasting specific lines for example in bash scripts or config files. Using triple click in normal text paragraphs works fine.
It looks like a Firefox bug that only affects Docusaurus sites 🤷♂️
Even though it's probably not our fault, we could investigate to find a workaround.
A span (or display: inline) should work; I've seen plenty of code blocks in other documentation systems that do not lead to this weird Firefox-only problem, and couldn't really figure out why it only seems to affect us.
But since using a <div> doesn't seem to produce any weird side-effect, let's make the change: #11565
Activity
slorber commentedon Sep 12, 2024
Thanks for reporting
Indeed this is really surprising. I can only reproduce it in Firefox.
And I can't reproduce it using prism-react-renderer demo https://stackblitz.com/~/github.com/FormidableLabs/prism-react-renderer
(Run
pnpm build && pnpm start:demo)It looks like a Firefox bug that only affects Docusaurus sites 🤷♂️
Even though it's probably not our fault, we could investigate to find a workaround.
lukaw3d commentedon Sep 12, 2024
Quickly scanning the code I would guess the cause is
spanhere, instead ofdivhttps://github.com/facebook/docusaurus/blob/611842af914fcdde5530082154a2c3b6b0a9e66c/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx#L35
matevz commentedon Nov 14, 2024
I can confirm the issue still exists on Firefox 131.0.3 and Docusaurus 3.6.1.
Was #10621 spam?
slorber commentedon Nov 14, 2024
The code of that PR is not even working, probably AI-generated
mwestphal commentedon Nov 15, 2025
We are impacted over at https://f3d.app
slorber commentedon Nov 21, 2025
A span (or
display: inline) should work; I've seen plenty of code blocks in other documentation systems that do not lead to this weird Firefox-only problem, and couldn't really figure out why it only seems to affect us.But since using a
<div>doesn't seem to produce any weird side-effect, let's make the change: #11565This is also what the underlying lib recommends apparently: https://github.com/FormidableLabs/prism-react-renderer