user-select style is ignored for programmatic selections

NEW
Unassigned

Status

()

Core
Layout: Form Controls
a year ago
a year ago

People

(Reporter: Marijn Haverbeke, Unassigned)

Tracking

52 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

a year ago
Created attachment 8820678 [details]
test.html

Elements with style `user-select: none` won't be shown as selected when the user creates a selection around them. In Chrome and Safari, they also aren't shown as being selected when a script sets the selection to be around them. In Firefox, they are.

You could, I guess, read the name `user-select` to mean that this is exactly the right behavior, since the _user_ wasn't the on who created the selection, but a major use case of this property is to hide selection style for a given piece of content, for example because it's not logically part of the selection even though it's in the selected DOM range (line numbers in an editor, for example). Also, selections created by JavaScript are generally created _on behalf of_ the user, so this distinction seems arbitrary and not very accurate.

Attached example file shows the issue. If you drag over the text, 'hello' remains white, but if you press the button, it becomes blue (or whatever your selection style is).

Would you consider adjusting this behavior to match that in other browsers?

Comment 1

a year ago
Reproducible with latest Nightly.

--
Version 	53.0a1
Build ID 	20161226030205
Update Channel 	nightly
User Agent 	Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Component: Untriaged → Layout: Form Controls
Product: Firefox → Core
You need to log in before you can comment on or make changes to this bug.