16
\$\begingroup\$

As of today (November 4, 2025), all code blocks on Stack Overflow have a “Copy” button. From Results of the October 2025 Community Asks Sprint: copy button for code blocks, and more on Meta:

As of today, users will be able to copy blocks of code directly from posts on Stack Overflow, by clicking the new Copy button in the top right corner of the code block.
[...]
We can also enable this feature on other tech sites that use code blocks, let us know here if this functionality would benefit other Stack Exchange communities.

I think this would be a useful feature for Code Review as well.

Questions on Code Review must contain (real, working) code, and the first step in crafting a review is often to run the posted code. Also answers do often quote parts of the posted code. A “Copy” button would make this easier and less error-prone.

(In a comment to my answer on Meta it was suggested that we discuss this on Code Review Meta first and then, if there is sufficient support by this community, forward the feature request to a CM.)

\$\endgroup\$
6
  • 5
    \$\begingroup\$ I'm adding the [featured] tag, just to ensure that the community has the greatest chance to see this discussion and weigh in. :) \$\endgroup\$ Commented Nov 4 at 19:47
  • 2
    \$\begingroup\$ I wouldn't use it (PRIMARY selection being more convenient than CLIPBOARD), but see no objection to enabling it for those who like clipboard. Edit: Posted on Meta Meta \$\endgroup\$ Commented Nov 5 at 10:46
  • 1
    \$\begingroup\$ I don't see a downside. Is there a downside? \$\endgroup\$ Commented Nov 5 at 15:36
  • 1
    \$\begingroup\$ Related: A little "copy" button above each code block would be cool and far more tangentially Viewing the source code. \$\endgroup\$ Commented Nov 11 at 17:08
  • \$\begingroup\$ @Peilonrayz How do you like it so far? Any issues / remarks? I asked for the copy button in a sprint and indicated that e.g. ChatGPT has it as a feature that could be interesting to reuse. Actually I mentioned that it could be tested here (as this site would benefit most, imho), but I guess they went for SO downright. \$\endgroup\$ Commented Nov 18 at 12:35
  • \$\begingroup\$ @MaartenBodewes FWIW I can appreciate testing on SO over CR. CR is kinda quite lately and SO/SE allows for the change to make the biggest waves and so the biggest drama. (Good drama here.) Something we've wanted for just a little while now, so seeing a positive change is certainly nice. Thanks. \$\endgroup\$ Commented Nov 18 at 12:49

3 Answers 3

8
\$\begingroup\$

I've turned this feature on for Code Review.

This feature takes a dependency on syntax highlighting, so if there are any tags that do not have an appropriate language configured, moderators will need to adjust them. Code Review's had syntax highlighting for forever though, so I suspect there will be few issues, if any.

\$\endgroup\$
1
  • \$\begingroup\$ Seems to work with our somewhat unique JavaScript setup. (Example) I can't see an issue with the syntax highlighting requirement. If one manifests please flag and we'll try handle the best we can. \$\endgroup\$ Commented Nov 13 at 21:53
17
\$\begingroup\$

Yes

(Just to avoid ambiguity between a good question and agreement with the question)

\$\endgroup\$
0
\$\begingroup\$

Let's add symmetry to the existing answer:

No

I do not think it's a good idea. A lot of snippets here (especially in the answers) are purely illustrative, and copying them is not so necessary. Usually it wouldn't be an issue (extra functionality is often better than none at all), but this button adds a lot of noise: it almost doubles the height of short 2-3 line snippets, so the post as a whole will be longer and harder to read. IMO this drawback overweights the (minor) usability improvement for some users.

Alternatively, can this be only enabled for questions?

\$\endgroup\$
3
  • \$\begingroup\$ Oops, @Peilonrayz sorry, I'm trying to fight the on-screen keyboard and the tiny comment box from my phone, and replying to another part took me a while \$\endgroup\$ Commented Nov 8 at 14:23
  • 2
    \$\begingroup\$ I don't like the vertical space it takes. Now if it was a context menu item for the pointer device or fit in scroll-bar space (I hardly profit with no vertical scroll bar)… \$\endgroup\$ Commented Nov 10 at 8:35
  • 1
    \$\begingroup\$ To add insult to injury, the waste doesn't show up in preview?! \$\endgroup\$ Commented Nov 16 at 5:42

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.