3

This question is about how to disable selection of DOM elements via user interaction. (This is wildly important for some rich HTML apps like games.)

The most common solution is the user-select: none CSS rule (plus its browser-specific variants) which indeed does the trick for now.

However, a comment mentions that this feature was only a draft and isn't present in the current CSS specification.

What's the story here? Was this feature renamed or perhaps was it made obsolete on purpose? Can I count on this feature to remain functional or should I start implementing it differently or avoid it altogether?

Community
  • 1
  • 1
Kos
  • 70,399
  • 25
  • 169
  • 233
  • 2
    I think it was rejected on the basis that you shouldn't use CSS to modify behavior. Let me scour the mailing lists and see what I can find... – BoltClock Oct 10 '12 at 17:45
  • Use javascript `onselectstart="return false;"` instead – Mr. Alien Oct 10 '12 at 17:47
  • It seems to have been lost in time (along with the ancient css3-userint draft). Right now, the main issue lies with gross inconsistencies in browser implementations, due in part to the fact that it's not specced anymore (go figure...). – BoltClock Oct 10 '12 at 17:52
  • Also, I would hesitate on calling something a standard even if it's in the "current specification", *unless* the specification is at least a Candidate Recommendation. – BoltClock Oct 10 '12 at 17:55

1 Answers1

0

This will hide any selections

::selection {
    background: transparent;

}
Darwayne
  • 1,400
  • 14
  • 14