marijnh/CodeMirror2 — Issue #210: Line selection gets thrown off by absolute or fixed positioning in IE8
Author: dcneiner
Created: 2011-10-18 04:59:53+00:00
State: open

I was working on a reduced test case, when I discovered the bug is readily reproducible using the [Full Screen demo](http://codemirror.net/demo/fullscreen.html) from the Code Mirror website.

If the `.CodeMirror` div, or any parent div, is given `absolute` or `fixed` positioning, the selection code breaks in IE 8 (And 7 I think).

**Steps to reproduce:**

* Visit the [Full Screen demo](http://codemirror.net/demo/fullscreen.html) page in IE 8
* Click in the editor, then hit `Escape`
* Try to select lines in the middle of the screen.

**Expected Bug that appears:**

The editor will immediately scroll to the bottom. In my personal code, I have also run into a bug that causes the selection to start to become offset from the actual text selected – this seems to be caused when lines run longer than the visible part of the editor.

**Possible Workaround**:
Since it works great with 'relative' positioning, Instead of using CSS, use JavaScript to provide negative `top` and `left` values, and a set `height` and `width`. In my quick test, this seemed to not cause an issue.