getClientRects() method doesn’t work with absolute positioned elements in EDGE
Confirmed Issue #15068329 • Assigned to Travis L.
Steps to reproduce
My colleague is currently experiencing an issue with text selection in IE 11.726.15063.0 and EDGE 40.15063.674.0.
The goal is to get text selection working where it returns to me the getClientRects.
Here is the setup:
divs with absolute positions and simple JS code:
document.addEventListener('mouseup’, function(e) {
let selection = window.getSelection();
let range = selection.getRangeAt(0);
let rects = range.getClientRects();
//check console for result.
console.log('this is the rects’, rects);
});
You can check it in action here:
http://jsfiddle.net/p4Lu4/10/
(Try to select more than 1 line of text and check the console)
I am expecting:
range.getClientRects().length()
to be > 0, but in fact it is almost always equals to 0
How can I reach this without changing UI layout and styles ?
IMPORTANT: I can’t change UI styles and my elements should stay absolute
Thanks
You need to sign in to your Microsoft account to add a comment.
Sign in