Opened 9 years ago
Last modified 9 years ago
#14337 confirmed Bug
[IE] Proper selection restoring after modification of text while unfocused
Reported by: | kkrzton | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Core : Selection | Version: | |
Keywords: | IE | Cc: |
Description
In IE (opposite to other browsers) opening dialogs causes loss of focus in editable area. When focus is lost selection is stored (core/selection.js#L957) and when focus is gained again by editor, saved selection is restored (core/selection.js#L936 and core/selection.js#L1650).
The problem is when during the unfocused period something in an editable area is changed (especially in nodes that were selected and are going to be used for restoring). In such case restoring selection produces some unexpected results because of the changes, e.g.
- Open demo (http://ckeditor.com/demo#full)
- Remove all sample content
- Type
test case 1
- Select
tes[t case 1]
- Press Replace button on the toolbar
- In the Find what field type: case
- In the Replace with field type: cc
- Press Replace All button
- Press OK button on the notification Message Box
- Press close button on the Find and Replace dialog
Selection which was restored is:
tes[t ]c 1
and probably should be (that's the way it works in other browsers):
tes[t c 1]
In this particular case the restored selection looks like this because text node where split (while replacing) to:
test |c| 1
and saved selection points to first text node with valid startOffset but outdated endOffset (so the selection ends where text node ends). There are also other cases like #12459, #11962.
Happens in IE8 - IE11.