Open Bug 1599871 Opened 5 years ago Updated 1 year ago

user-select:none on html element causes click to select all contenteditable text

Categories

(Core :: DOM: Selection, defect, P3)

70 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: john_thomson, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36

Steps to reproduce:

See https://jsfiddle.net/john7540/h8123ay4/7/.
It involves a div with a fixed size so it is possible to click on the <html> element outside it. The div is contenteditable. Styles make everything (including the root <html> element) user-select:none, except that contenteditable elements are user-select: text.
In the resulting view, click outside the yellow box (the content-editable div). That is, the click should not hit anything except the root <html> element.

Work-around: add a special-case rule html {user-select: auto}

(Also experience in FF 45)

Actual results:

All the text in the contenteditable div appears to be selected (though it doesn't get focus).
(In more complex cases involving multiple contenteditable elements, all the text in ALL of them appears selected)

Expected results:

Nothing (Edge)
focus leaves the contenteditable div (Chrome)
both seem reasonable.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Editor
Product: Firefox → Core
Component: DOM: Editor → DOM: Selection
Priority: -- → P3
Severity: normal → S3

This issue is still there. For an even more distilled fiddle, see https://jsfiddle.net/bkLhz7fq/

You need to log in before you can comment on or make changes to this bug.