Skip to content

Copy button only copies partial content from code blocks in docs #546

@MrQuantum1915

Description

@MrQuantum1915

On the zustand documentation site, when using the copy button on code blocks (e.g., for the section "What are you building?"), only a partial snippet is copied to the clipboard. For example, clicking copy copies only:

import { create

instead of the full code block in the ```js section. This was reproduced in both Brave and Chrome browsers.

Steps to reproduce

  1. Go to https://zustand.docs.pmnd.rs/learn/guides/tutorial-tic-tac-toe
  2. Scroll to the section where you build the tic-tac-toe game, under "What are you building?"
  3. Click the copy button on the displayed code block.
  4. Check clipboard contents. Only partial code is copied, not the full snippet.

Clicking the copy button should copy the entire contents of the code block to the clipboard.

Environment

  • Brave and Chrome browsers, latest versions

Additional context

Component reference : src/components/mdx/Code/Code.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions