Opened 8 years ago

Last modified 8 years ago

#14386 confirmed New Feature

Unify compositable input change events

Reported by: kkrzton Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


Compositable input is handled differently in different browsers which means the change event in CKEditor is also fired differently when handling compositable input. Composition events (composition events w3c specs) concerns typing in Japanese (and other languages in which typing one symbol involves more than one keystrokes) and some mobile typing (e.g. suggestions).

According to tests from ticket #14329 and some additional testing:

  • In Blink change event is fired with every key press, it is not fired for confirmation (when enter is pressed) but it is fired more than once (two, sometimes three times - needs additional testing) when you move to new line (when enter is pressed for the second time). Change event is also fired for keys which cancels composition (backspace, delete, esc), but it is not fired when during composition editor loses focus (which means the end of composition so word/symbol is inserted).
  • In FF change event is fired for confirmation (when enter is pressed). For second enter press it behaves same as in Blink (two, three change events fired). Change event is also fired when canceling composition (backspace, delete, esc) - same as in Blink and losing focus during composition behaves also same as in Blink.
  • In IE change event is not fired for confirmation (when enter is pressed) but it is fired twice when you move to new line (when enter is pressed for the second time). IE doesn't fire any change event when handling composition. There is proposed fix for this behavior (#14329), but it also may need some unification.

Native events flow differs also a little in above browsers. Most important differences:

  • IE8 does not support composition* and textinput event.
  • IE11 has a specific bug which won't be fixed.
  • Edge - after compositionend, there are no further events fired for action which caused compostionend (usually it is enter keyup event). It seems it is consistent with specs: "During the composition session, all keydown and keyup events may be suppressed.".
  • Chrome fires keydown event (with key code 229) after compositionend event for enter key. In all other browsers it is keyup event with key code 13.

Native event flow tested with this jsfiddle.

Unifying change event for compositable input should result in consistent change event firing in all browsers. It seems like the best approach is to fire change event only when symbol/word is inserted (after end of composition). Also it should not be fired for keys which cancels composition. It may be achieved using compositionstart and compositionend events, there is also data attribute for those events which holds currently composed input.

For more "historical" context, see #14329.

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