New issue
Advanced search Search tips

Issue 636501 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Incorrect clientRects calculated on a contenteditable div

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

Issue description

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

Steps to reproduce the problem:
1. create div with contenteditable attribute and contains an image inline with text
2. select just some of the text on the same line as the image
3. execute getSelection().getRangeAt(0).getBoundingClientRect().height

What is the expected behavior?
return the height of the selection which should be the height of the image or text whichever is greater.

What went wrong?
returns the height of the selection if there was no image inline with the text

Did this work before? No 

Chrome version: 53.0.2785.46  Channel: beta
OS Version: 10.0
Flash Version: Shockwave Flash 22.0 r0

I created a jsfiddle that demonstrated this

https://jsfiddle.net/UziTech/ksr2oers/
 

Comment 1 Deleted

Comment 2 by tbri...@gmail.com, Aug 10 2016

I this image the selection is about 23px in height but getBoundingClientRect() reports it as 15px
cbug.PNG
26.4 KB View Download
Components: -Blink Blink>TextSelection Blink>Layout
I'm not sure this is a bug; the text in the selection is only 15px high. It is true that we paint the selection rectangle bigger, though.
Have you tested other browsers? (Firefox/Edge)

Comment 5 by tbri...@gmail.com, Aug 12 2016

I have not tested it thoroughly in other browsers but the little I did test suggests there is no standard. For instance ie only paints the text but returns 23px for the height.

Comment 6 by e...@chromium.org, Aug 12 2016

Components: Blink>Editing
Status: WontFix (was: Unconfirmed)
This is intentional, we return the height of the text.

The behavior here is not standardized and it's unclear what the desired height should be. Some applications depend on the current implementation to position annotations around the text which would break if we were to change this. 

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

Components: -Blink>TextSelection Blink>Editing>Selection

Sign in to add a comment