Incorrect clientRects calculated on a contenteditable div
Reported by
tbri...@gmail.com,
Aug 10 2016
|
||||
Issue descriptionUserAgent: 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/
,
Aug 10 2016
I this image the selection is about 23px in height but getBoundingClientRect() reports it as 15px
,
Aug 12 2016
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.
,
Aug 12 2016
Have you tested other browsers? (Firefox/Edge)
,
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.
,
Aug 12 2016
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.
,
Oct 12 2016
|
||||
►
Sign in to add a comment |
||||
Comment 1 Deleted