getClientRects() method doesn’t work with absolute positioned elements in EDGE

Confirmed Issue #15068329 • Assigned to Travis L.


Peter E.
Dec 12, 2017
This issue is public.
Found in
  • Microsoft Edge
  • Internet Explorer
Reported by 2 people

Sign in to watch or report this issue.

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:

(Try to select more than 1 line of text and check the console)

I am expecting:
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



0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “travil”

      Changed Status to “Confirmed”

      Changed Assigned To from “travil” to “Travis L.”

    You need to sign in to your Microsoft account to add a comment.

    Sign in