mcanouil/quarto-preview-colour

Disable selection of glyph for copying and pasting?

andrewheiss opened this issue · 4 comments

This is a neat extension!

In a recent blog post, I did something similar with little swatches (though not for hex codes specifically):

image

I added user-select: none to the CSS for the glyph so that when users select/copy the text, the glyph doesn't get picked up too:

image

Would it be worth adding that to the inline CSS at https://github.com/mcanouil/quarto-preview-colour/blob/b2f38e4d35037e8b4f1334b5e51871f8d812856f/_extensions/preview-colour/preview-colour.lua#LL51C70-L51C70 or would that go beyond the scope of the extension?

I intend to turn the circle into a copy button and make it not selectable, although I did not go that far.

Thank you for the suggestion.

To note, leaving the glyph in the text does not aligned with my accessibility goal, i.e., screen reader will catch the glyphs.

Ah, I see. My goal was to have screen readers ignore it—it was just extra flair, but not structurally important. I like the copy button idea a lot!

If you want to contribute, don't hesitate 😉

A simple (not complete) roadmap:

FYI, the whole thing originated from quarto-dev/quarto-cli#5908.