'unselectable' attribute for HTML elements not supported




10 years ago
4 years ago


(Reporter: Kier, Unassigned)



Firefox Tracking Flags

(Not tracked)


(Whiteboard: [needs decision if we will implement it], URL)



10 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9b5) Gecko/2008032619 Firefox/3.0b5

Have tried setting unselectable in three different ways:

<div unselectable="on">
div.unselectable = "on";
div.setAttribute("unselectable", "on");

All appear to be ignored by Firefox 3 on the Mac.

This has major implications for WYSIWYG editors, which rely upon formatting controls being unselectable to prevent focus being removed from the selected text.

Reproducible: Always

Steps to Reproduce:
1.Set elements to be unselectable using HTML or script
2.Attempt to select 'unselectable' text
Actual Results:  
Text is selectable and highlights accordingly

Expected Results:  
Text should not be selectable and should not highlight

This problem does not appear to affect Firefox 3 Beta 5 under Windows.
Component: General → DOM: Mozilla Extensions
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
The only way I can imagine that it's working for you on Windows is if you are running the IETab extension, and not noticing that you're seeing it work in IE inside Firefox - far as I can tell, Gecko has never implemented it, and hasn't ever even had a WONTFIXed request to implement it.

Comment 2

9 years ago
I didn't find mentions of "unselectable", nor any discussions on supporting/removing it on the html mailing list...

Interestingly, our HTML5 parser has mentions of it
http://mxr.mozilla.org/mozilla-central/search?string=unselectable (although it doesn't actually do anything, just mentioned in the parser)

Henri, do you know where does it come from and was there a decision as part of HTML5 efforts about it?
Severity: normal → enhancement
Ever confirmed: true
OS: Mac OS X → All
Hardware: PowerPC → All
Summary: Firefox 3 Beta 5 under Mac OS X ignores the 'unselectable' attribute for elements. → 'unselectable' attribute for HTML elements not supported
Whiteboard: [needs decision if we will implement it]
The HTML5 parser pre-interns "well-known" names. I guess I've deemed that attribute as "well-known" but I don't recall on what basis.
Hixie doesn't recall unselectable having been considered for inclusion in HTML5.


5 years ago
Component: DOM: Mozilla Extensions → DOM
Product: Core → Core

Comment 5

4 years ago
There is no and, according to #4, never has been any mention of this in any HTML standard, and I believe that no user agent besides Internet Explorer have any support for this.

Instead, authors are generally advised (e.g. http://stackoverflow.com/a/4448972/362030 and http://help.dottoro.com/lhwdpnva.php) to use vendor-prefixed versions of the CSS user-select property.
-moz-user-select:none has been supported since at least Firefox 2, and Webkit, Opera, and IE10+ each have their own vendor-prefixed versions: http://caniuse.com/user-select-none
Though technically not part of any official standard either (apparently it was proposed for CSS3-USERINT, which got superseded by CSS3UI which forgot about it: http://ie.microsoft.com/testdrive/HTML5/msUserSelect/), I'd say that level of interop makes it a de facto standard.

I believe this bug should be marked INVALID.
You need to log in before you can comment on or make changes to this bug.