Open Bug 429643 Opened 16 years ago Updated 2 years ago

'unselectable' attribute for HTML elements not supported

Categories

(Core :: DOM: Core & HTML, enhancement, P5)

enhancement

Tracking

()

People

(Reporter: kier, Unassigned)

References

()

Details

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

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">
and
div.unselectable = "on";
and
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.
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
Status: UNCONFIRMED → NEW
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.
http://krijnhoetmer.nl/irc-logs/whatwg/20090922#l-647
Component: DOM: Mozilla Extensions → DOM
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.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.