Opened 8 years ago

Last modified 8 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:


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.

  1. Open demo (
  2. Remove all sample content
  3. Type test case 1
  4. Select tes[t case 1]
  5. Press Replace button on the toolbar
  6. In the Find what field type: case
  7. In the Replace with field type: cc
  8. Press Replace All button
  9. Press OK button on the notification Message Box
  10. 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.

Change History (1)

comment:1 Changed 8 years ago by kkrzton

Status: newconfirmed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy