blitzjs.com icon indicating copy to clipboard operation
blitzjs.com copied to clipboard

Copying code copies +/- too although they aren't highlighted.

Open bcye opened this issue 2 years ago • 6 comments

I was just going through the tutorial and noticed when copying the code it copies the +/- too although they are not highlighted.

Screenshot

this copies:

choices: z.array(
+     z.object({id: z.number().optional(), text: z.string()}),
+   ),

I'm using Safari 15.0 on macOS Monterey.

bcye avatar Sep 30 '21 22:09 bcye

thank you!

flybayer avatar Sep 30 '21 23:09 flybayer

I can't replicate in Brave. Maybe it's a problem of Safari

JuanM04 avatar Sep 30 '21 23:09 JuanM04

Weird just tried in Brave and the problem exists there too.

bcye avatar Oct 01 '21 15:10 bcye

I did some research and it seems to be caused by this webkit issue, where -webkit-user-select: none doesn't select the text, but copies it if your selection starts before it and ends after it.

I tried it on Chrome and the problem doesn't exist there, though it does in Brave...

bcye avatar Oct 01 '21 16:10 bcye

I found this workaround but this leads to the text being selected but not copied.

bcye avatar Oct 01 '21 16:10 bcye

I did some research and it seems to be caused by this webkit issue, where -webkit-user-select: none doesn't select the text, but copies it if your selection starts before it and ends after it.

It must be, the code generated by Tailwind contains the webkit flag:

-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;

I also tried in a Mac with Chrome and Firefox: none has this issue, only Safari

JuanM04 avatar Oct 01 '21 19:10 JuanM04