New issue
Advanced search Search tips

Issue 637296 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

no clientRects given when cursor is next to an image in contenteditable div

Reported by tbri...@gmail.com, Aug 12 2016

Issue description

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

Steps to reproduce the problem:
1. create div with contenteditable attribute that contains an image
2. place cursor on either side of the image
3. execute getSelection().getRangeAt(0).getClientRects()

What is the expected behavior?
return a ClientRectList with 1 ClientRect representing the cursor

What went wrong?
returns a ClientRectList with length 0;

Did this work before? No 

Chrome version: 53.0.2785.57  Channel: beta
OS Version: 10.0
Flash Version: 

here is a jsfiddle to test it:
https://jsfiddle.net/UziTech/ksr2oers/
 
Components: -Blink Blink>TextSelection Blink>Layout

Comment 2 by yosin@chromium.org, Aug 15 2016

Components: -Blink>TextSelection -Blink>Layout Blink>TextSelection>Caret
Status: Available (was: Unconfirmed)

Comment 3 by tkent@chromium.org, Oct 12 2016

Components: Blink>Editing>Selection

Comment 4 by tkent@chromium.org, Oct 12 2016

Components: -Blink>TextSelection>Caret
This is working as intended:

When the cursor is next to the image, its Range is a collapsed range at (div, 2) or (div, 4). According to the spec (*), getClientRects() should return:

- The range doesn't select any element, so no element's border area is added to result list
- The range doesn't select or partially select any Text node, so no rect from Text nodes is added to result list

So it returns an empty list.

Unless we want to change the spec, say, by adding a special case when the range is collapsed and right next to a Text node or replaced element?

(*) https://drafts.csswg.org/cssom-view/#dom-range-getclientrects

Comment 6 by tbri...@gmail.com, Aug 16 2017

If a collapsed range inside, or next to, a text node is considered "partially selected" then it seems like a collapsed range next to an image element should also be considered "partially selected".

We may have to change the spec to account for partially selected elements

Comment 7 by yosin@chromium.org, Oct 4 2017

Labels: Pri-3
Project Member

Comment 8 by sheriffbot@chromium.org, Oct 4

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment