Menu

1 / 2

Copy Fail: I Reproduced the Most Viral HN Bug in My Own Code and Found Something Worse

DEV Community·Juan Torchia·6 months ago
#c1LnSrw0
#scenario#typescript#clipboard#copy#document
Reading 0:00
15s threshold

Copy Fail: I Reproduced the Most Viral HN Bug in My Own Code and Found Something Worse

I was wiring up a "Copy token" button in an admin panel when the Clipboard API threw me an undefined without a single error in the console. The user would have clicked the button, seen the green check, and pasted nothing into their terminal. Or worse: pasted whatever was already in their clipboard — which in that context could be literally anything.

That's when I remembered the Copy Fail post that was sitting at #1 on Hacker News with 977 points. I went and read it. It was a solid analysis. But it was missing the part that mattered most to me.

The Copy Fail Viral Bug: What HN Says and What It Leaves Out

The original post documents a real and genuinely annoying behavior: navigator.clipboard.writeText() fails silently in certain contexts. No exception. No visible promise rejection if you don't handle it properly. Nothing.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.