Daniel Schwarz 3 months ago
Front-end development
I learned CSS user-select: (stop users copying text!)
Daniel Schwarz 3 months ago
Beware of a11y concerns :)
Dmitrii Pashutskii 3 months ago
Oh, that's cool! I didn't know about this selector.
Daniel Schwarz 3 months ago
Property 😁 Example: article.log-in-to-read-this { user-select: none; // user cannot select (copy) the article } Full code: article { opacity: 0.5; // opaque filter: blur(0.5rem); // blurry user-select: none; // remove selection pointer-events: none; // remove all events } Also: document.querySelector("article").setAttribute("tabindex", "-1"); // user cannot focus on the links inside the article
Daniel Schwarz 3 months ago
My line breaks 😭
Dmitrii Pashutskii 3 months ago
Yeah, I need to improve comments! Working on it!