Opened 10 years ago

Last modified 9 years ago

#12391 assigned Bug

[IE] No undo snapshots created when using IME (input method engine)

Reported by: Piotrek Koszuliński Owned by: Artur Delura
Priority: Normal Milestone:
Component: General Version: 4.2
Keywords: IME IE Cc: ehudm@…

Description

When typing in language that requires character composition (e.g. Japanese, Korean or Chinese) undo manager does not record snapshots. Reproducible only on IEs.

To reproduce:

  1. Enable e.g. Japanese language (see instructions in #8854). Tip: it's useful if you enable the language floating toolbar in Windows.
  2. Set input mode to Hiragana.
  3. Start typing random letters in editor. Some will be composed into Japanese characters, but that's not important. What's important is that you can see that inputted text is underlined what means that you're in composition mode. Press enter to finally input text.
  4. See that undo button never gets enabled.

Reproducible from CKEditor 4.2.0.

Change History (8)

comment:1 Changed 10 years ago by Piotrek Koszuliński

Status: newconfirmed

I did some research and have couple of findings.

First bad commit

In this case better to talk about branch and it was git:1330466 so #9794. To introduce a change event we started using keypress event and keypress is not fired when composing a character.

IME in IE

I did some research on how could we attempt to fix this issue. In other browsers there's no problem because they fire the input event on composition end (iirc). IEs do fire only keydown and keyup on every key, but no input or keypress.

At least on IE11, when composing, every keydown has a key code 229 which means that engine is still processing character. Key codes on keyup represents the pressed keys. What's more - if composition ends on keyup, then keyup is doubled - first is for composition, second does what it should - e.g. represents an arrow key. So to discover composition end, so the moment which we should handle in the same way as input event, we could track IME keydowns followed by first keyup which we know that means composition end - e.g. enter, arrows, mouse event. However, if MDN is rigth that composition events are available in all IEs, we won't need to implement this ridiculous tracking.

Note: Don't make this mistake - when composition starts (before it's commited) undo button should not be activated.

Interesting articles:

comment:2 Changed 10 years ago by Piotrek Koszuliński

Summary: [IE] No undo snapshots create when using IME (input method engine)[IE] No undo snapshots created when using IME (input method engine)

comment:3 Changed 10 years ago by Artur Delura

Owner: set to Artur Delura
Status: confirmedassigned

comment:4 in reply to:  1 Changed 9 years ago by Artur Delura

Replying to Reinmar:

In other browsers there's no problem because they fire the input event on composition end (iirc)

Other browsers fire input event on compositionupdate as well.

At least on IE11, when composing, every keydown has a key code 229

Each browser do the same.

What's more - if composition ends on keyup, then keyup is doubled - first is for composition, second does what it should - e.g. represents an arrow key.

I didn't noticed that arrow key end composition, but what I noticed is that compositionupdate is not fired on IE when press arrow key.

However, if MDN is rigth that composition events are available in all IEs, we won't need to implement this ridiculous tracking.

It does not work on IE8. No composition* events are fired.

Note: Don't make this mistake - when composition starts (before it's commited) undo button should not be activated.

I'm not why, because input event is called on each compositionupdate. Even when arrow pressed.


Let me tell how look events flow in browsers:

When we start composition (single key pressed).

  • keydown - keycode (229)
  • compositionstart
  • compositionupdate
  • onInput
  • onKeyup - keycode (represents keyboard key).
  • CKEditor:change

When we update composition (single key pressed).

  • keydown - keycode (229)
  • compositionupdate
  • onInput
  • onKeyup - keycode (represents keyboard key).
  • CKEditor:change

When we finish composition (enter key pressed).

  • keydown - keycode (229)
  • compositionend
  • onInput

When we finish composition (mouse click).

  • compositionend
  • onInput

Diffrences between browsers:

All IEs - there is no input nor keypress event when composition is updating or finished.

Firefox - there is no keyup event.

Chrome, opera - no keyup event on ENTER key.


What is suggest to do is fix diffrences betweens browsers (IE and FF),


Known issues:

  • Ctrl + Shift + Z does not redo changes. - I think that change is fired on this keystroke so snapshots stack is cleared.
Last edited 9 years ago by Artur Delura (previous) (diff)

comment:5 Changed 9 years ago by Artur Delura

Based on specification I think that we shouldn't rely on key events while composition - just ignore them. I think that we should make snapshot on compositionend event and reset undo manager.

Last edited 9 years ago by Artur Delura (previous) (diff)

comment:6 Changed 9 years ago by Artur Delura

According to comment above I pushed changes into branch:t/12391b.

comment:7 Changed 9 years ago by Piotrek Koszuliński

I reported the "no redo" problem in #12823.

comment:8 Changed 9 years ago by Ehud Michelson

Cc: ehudm@… added
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