Open Bug 1540870 Opened 5 years ago Updated 4 months ago

contenteditable: cursor disappears before span with background color

Categories

(Core :: Layout: Text and Fonts, defect, P3)

60 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: tbosch, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36

Steps to reproduce:

Create a contenteditable div that contains a span which has a set background color:

<div contenteditable=true>
Before<span style="background-color: #ffff">Inside</span> After
</div>

Place cursor at start at move before the span via arrow keys. I.e. so that the cursor is before the "I" of "Inside"

JsFiddle: https://jsfiddle.net/5y0x6drs/

This is on an ubuntu linux using Firefox Quantum 60.6.0esr.

Actual results:

The cursor disappears.

Expected results:

The cursor should not disappear.

Also moving the cursor one char to the right makes it visible again.

Adding mix-blend-mode: difference reveals that the cursor is there, but uses the color of the background.

Component: Untriaged → Editor
Product: Firefox → Core

My use case: Show a typeahead in the contenteditable at the cursor position via a <span>.
This bug always hides the cursor before this kind of typeahead as the typeahead has a background color.

Component: Editor → Untriaged
Product: Core → Firefox

Ups, sorry, I accidentally overwrote your triaging changes while submitting my comment :-(

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

Sounds like a caret painting issue. Although I don't understand what hides/overlaps the caret. In my understanding, caret is painted on the topmost layer except outline, but the color is color property's computed value. Therefore, that may conflict with background-color or color at element boundary.

Ideally, we could re-paint text with background color or opposite color of color after painting caret with making outside caret rect, though.

Component: DOM: Editor → Layout: Text and Fonts
You need to log in before you can comment on or make changes to this bug.