Skip to content

TPI: Markdown code-block Copy #340777

Closed
Closed

Description

@rwoll

Refs: #340756

Complexity: 1

Authors: Ross Wollman (@rwoll)

Create Issue


Image
  1. Open or create a *.md file in VS Code and add a markdown codefence block (```) with some random content.
  2. Click away to move focus off the document.
  3. Hover over the codefence block and observe that a Copy symbol appears in the upper right corner of the block.
  4. Click it to copy and then paste it somewhere!

Activity

  1. added this to the 1.142.0 milestone on Oct 9, 2026
  2. changed the title [-]Markdown code-block Copy[/-] [+]TPI: Markdown code-block Copy[/+] on Oct 9, 2026
  3. anthonykim1 commented on Oct 12, 2026

    @anthonykim1
    Contributor

    Verified on macOS 26.7.1 arm64 using VS Code Insiders 1.142.0-insider (ff00e788322523ee1e9e8ee2c9bb4b89af93a3c2).

    I opened a .md file with a fenced code block in the Markdown Editor, clicked the Explorer so the editor no longer had focus, hovered the code block, clicked Copy once, and pasted into a new untitled editor. I checked the editor's focus before the click, the button's feedback, and the system clipboard, and ran the same steps on Insiders ed380adf, the last Insiders build without the fix, as a baseline.

    Verified:

    • The Copy button is hidden until the code block is hovered, then appears in its upper-right corner
    • The first click works while the Markdown Editor does not have focus
    • The copied text matches the code block exactly, without the fences
    • Pasting into another editor produces the same text

    Results:

    • ed380adf: the first click showed "Could not copy code block. Try again.", the clipboard was unchanged, and the console logged NotAllowedError: Document is not focused
    • Insiders: the first click showed "Code block copied", the system clipboard contained exactly the three code lines, and no copy errors were logged
    • Pasting into an untitled editor produced the same three lines

    Copying a code block from the Markdown Editor works on the first click in current Insiders, including after focus moves elsewhere.

    Before and after: the pre-fix build shows "Could not copy code block. Try again." after clicking Copy, while Insiders shows "Code block copied" and the pasted code block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

testplan-itemverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions