diff --git a/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts b/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts index 5c68eb17acb..552f6861865 100644 --- a/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts +++ b/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts @@ -189,7 +189,9 @@ export default class SelectionObserver extends Observer { this._documentIsSelectingInactivityTimeoutDebounced(); } ); - // On composition start upcast the selection, so it includes composed text to be replaced on composition end. + // Update the model DocumentSelection just after the Renderer and the SelectionObserver are locked. + // We do this synchronously (without waiting for the `selectionchange` DOM event) as browser updates + // the DOM selection (but not visually) to span the text that is under composition and could be replaced. this.listenTo( this.view.document, 'compositionstart', () => { this._handleSelectionChange( domDocument ); }, { priority: 'lowest' } );