pmndrs / pmndrs/docs

Copy button only copies partial content from code blocks in docs

Open
#546 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
119
Forks
100
Avg merge
35m
Merged PRs (30d)
2

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/components/mdx/Code/Code.tsx and reproduce the copy behavior on the tic-tac-toe tutorial page under “What are you building?” in Brave or Chrome. Trace how the displayed JavaScript code block is read for clipboard copying, then verify that clicking copy produces the complete block rather than only import { create .

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.