Skip to content

Fix clipboard copy in Firefox#216

Open
Candypopppsss wants to merge 2 commits into
Mohit-368:mainfrom
Candypopppsss:fix/clipboard-copy-firefox
Open

Fix clipboard copy in Firefox#216
Candypopppsss wants to merge 2 commits into
Mohit-368:mainfrom
Candypopppsss:fix/clipboard-copy-firefox

Conversation

@Candypopppsss

@Candypopppsss Candypopppsss commented Jun 2, 2026

Copy link
Copy Markdown

What this PR does

Fixes the Copy Raw button silently failing in Firefox by adding a robust cross-browser clipboard implementation.

Root cause

navigator.clipboard.writeText can throw NotAllowedError in Firefox when the page doesn't have clipboard-write permission or the page isn't in active focus.

Fix

  • Try navigator.clipboard.writeText first (Chrome, Edge, modern FF)
  • Fall back to document.execCommand('copy') via a temporary textarea
  • Show a sleek success or error toast message to the user after each attempt to provide clear visual feedback

Visual Previews

Success Toast Error Toast
Success Toast Error Toast

Testing

  • Chrome ✅
  • Firefox ✅ (was broken before)
  • Edge ✅
  • Safari ✅ (or N/A)
  • No console errors

Closes #216

@Candypopppsss

Copy link
Copy Markdown
Author

Hi! I have submitted a fix for the Firefox clipboard
bug. Would love a review when you get a chance
#216

@Karanjot786

Copy link
Copy Markdown

Hey @Candypopppsss! Saw your work on GSSoC 2026.

We are building TermUI, a TypeScript terminal UI framework with React-style hooks and JSX, rendered entirely in the terminal.

We have 99 unassigned GSSoC issues open across widgets, hooks, adapters, and CLI tooling. Your JavaScript background transfers directly.

Karanjot, TermUI maintainer

@Candypopppsss

Copy link
Copy Markdown
Author

hi @Karanjot786 Thank you for your approach ! I'll look into it

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants