styling the selection pseudo element of contenteditable elements using css
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: thomas, Unassigned)
Details
Attachments
(4 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Steps to reproduce:
I add the following to the style sheets div::selection{}.
Note: I am adding only the selector to the stylesheets. I am not applying any styling to the selection pseudo element. The mere presence of the ::selection selector in the stylesheets of an element already causes this bug.
Actual results:
In all contenteditable divs when you select something like a part of the text the selection isn't highlighted anymore. It gets selected. It's just not highlighted.
Expected results:
The selected part of the text should be highlighted. Just like it works when you don't add a ::selection selector to the stylesheets for contenteditable elements.
Updated•6 years ago
|
Comment 3•6 years ago
|
||
If there is something in the selection{}, it works.
Comment 4•6 years ago
|
||
You are right! Although you need to specify the background-color specifically. So adding only font-weight:bold doesn't fix it.
Updated•6 years ago
|
Comment 6•6 years ago
|
||
This behaves the same in other browsers except for the empty case (which is just a bogus optimization in other browsers). This came up recently in https://github.com/w3c/csswg-drafts/issues/4720, and this behavior may or may not change, but until then it's expected.
So I think this is wontfix? If you style the selection I think you should specify at least background-color, and probably color as well. It's also not specific to contenteditable.
Updated•6 years ago
|
Description
•