Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IME/typing bug-fixing #16289

Merged
merged 36 commits into from
Jul 3, 2024
Merged

IME/typing bug-fixing #16289

merged 36 commits into from
Jul 3, 2024

Conversation

niegowski
Copy link
Contributor

@niegowski niegowski commented Apr 25, 2024

Suggested merge commit message (convention)

Fix (typing, engine): Predictive text should not get doubled while typing. Closes #16106.

Fix (engine): The reverse typing effect should not happen after the focus change. Closes #14702. Thanks, @urbanspr1nter!

Fix (engine, typing): Typing on Android should avoid modifying DOM while composing. Closes #13994. Closes #14707. Closes #13850. Closes #13693. Closes #14567. Closes: #11569.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

niegowski and others added 22 commits April 18, 2024 17:40
Fix (typing, engine): Predictive text should not get doubled while typing. Closes #16106.
Fix (engine): The reverse typing effect should not happen after the focus change. Closes #14702.
…ges, not as a normal flow in IME. Composed text on Android should be inserted to the model only after it is available in the DOM (so on beforeinput is too early). So no mutations other by those made by IME.
…er avoiding programmatic DOM changes while composing.

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as outdated.

document.on<ViewDocumentFocusEvent>( 'focus', () => this._handleFocus() );
document.on<ViewDocumentBlurEvent>( 'blur', ( evt, data ) => this._handleBlur( data ) );

document.on<ViewDocumentInputEvent>( 'beforeinput', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments needed. Why we need to handle focus on every beforeinput? It was confusing initially that this actually SHOULD happen only once. Because it relies on the assumption that beforeinput is fired only for focused editors. Or not? If not, what happens then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: What happens when beforeinput is fired for a blurred editable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when beforeinput is fired for a blurred editable is described in this issue: #14702.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in ce023f1.

// @if CK_DEBUG_TYPING // }

insertAt( domElement as DomElement, i, expectedDomChildren[ i ] );
i++;
}
// Update the existing text node data. Note that replace action is generated only for Android for now.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was outdated. That's why we removed the 2nd sentence.

return;
}

if ( env.isAndroid && this.isComposing && actualText.replace( /\u00A0/g, ' ' ) == expectedText.replace( /\u00A0/g, ' ' ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in ce023f1.

this._compositionQueue.flush( 'composition end' );
} );

// Trigger mutations check after the composition completes to fix all DOM changes that got ignored during composition.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some examples when this is necessary to happen. It's sort of a backup. Some changes are handled "at their selection" and some generalized to the model element's scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in ce023f1.

// @if CK_DEBUG_TYPING // );
// @if CK_DEBUG_TYPING // }

view.document.fire<ViewDocumentMutationsEvent>( 'mutations', { mutations: [] } );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain that this will trigger the renderer to check all the nodes previously marked but ignored because the document was in the composition state (which blocks the renderer).

Also explain an example case when this is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in ce023f1.

@niegowski niegowski marked this pull request as ready for review July 3, 2024 09:20
@niegowski niegowski merged commit e4317d0 into master Jul 3, 2024
6 checks passed
@niegowski niegowski deleted the ck/epic/ime-typing branch July 3, 2024 09:21
@winzig
Copy link

winzig commented Jul 30, 2024

@niegowski What's the ETA on when this will be released, what version of CKEditor would it be in?

@Witoso
Copy link
Member

Witoso commented Jul 30, 2024

We are starting preparation for the release that is scheduled for the next week. Most likely it will be 43.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment