Grandma Marni’s paper coupon: set user-select on each part, select for real with a drag, a click, or Pilih semua, and getSelection().toString() shows what a…
Why it matters
A small detail people notice: a button label that turns blue when clicked quickly looks messy, and a coupon code you have to select letter by letter is annoying. But many mistake none for an anti-copy feature, which it is not.
The key idea
user-select governs what can be selected, not what can be taken
Common mistakes
Thinking user-select: none stops text being copied or stolen No. It only turns off selecting with the mouse. The text stays in the DOM and can be taken from JS (textContent), the Clipboard API, DevTools or view-source. Not a security feature.
Setting none on a parent kills selection in children that matternone carries to the children. Reopen the element that must be copyable with user-select: text (or all).
Selection behaves inconsistently in Safari Write -webkit-user-select together with user-select. Safari still uses the prefixed version for some values.
Try it in this playground
Select some of the coupon, then press Ctrl+C (Cmd+C) The copy event shows the text that was really copied, the same as getSelection().toString().
Set .card to none, then press Select all The selection is empty: every child goes none too. Look at each element’s computed value.
Set .coupon to all, then click the code once The whole code is selected at once, ready to copy.
With the coupon none, press its copy button or card.textContent The text still comes out. user-select is no lock.