Open Bug 1325040 Opened 8 years ago Updated 2 years ago

user-select style is ignored for programmatic selections

Categories

(Core :: Layout: Form Controls, defect)

52 Branch
defect

Tracking

()

People

(Reporter: marijnh, Unassigned)

Details

Attachments

(1 file)

Attached file 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?
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
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: