Skip to content

Copy markdown button gives no response when the clipboard write fails #132

Description

@nibzard

Summary

components/llm-share.tsx sets its copied state only after the clipboard write resolves. If the write fails, the button shows no change. The error goes to the console only.

Details

  • components/llm-share.tsx:76-80: setIsCopied(true) runs after await navigator.clipboard.writeText(...). The catch block only logs.
  • Clipboard writes can fail. Causes: permissions policy, browser extensions, or an unfocused document.
  • Other copy buttons set state before the await and always give a visual response. Example: components/docskit/copy-button.tsx:18-22.

Impact

This button is on every docs page. A failed write produces a click with no response. Microsoft Clarity counted 1,486 dead clicks across 166 sessions in the week of 2026-09-15 to 2026-09-22. This button is one contributor.

Suggested fix

Set the copied state before the await, or in a finally block. Add a visible error message if the write fails.

Activity

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

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