Skip to content

Commit

Permalink
fix(core): combobox handle IME input correctly to prevent accidental …
Browse files Browse the repository at this point in the history
…deletion of characters

closes [#12232](#12232)

## Description
Fixed `isComposing` prefix
  • Loading branch information
khotcholava committed Sep 4, 2024
1 parent 65bdbad commit 4b8552e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class AutoCompleteDirective {
private lastKeyUpEvent: KeyboardEvent;

/** @hidden */
private isComposing = false;
private _isComposing = false;

/** @hidden */
private readonly _elementRef = inject(ElementRef);
Expand Down Expand Up @@ -94,11 +94,11 @@ export class AutoCompleteDirective {
.subscribe((evt) => this._handleKeyboardEvent(evt));

compositionStartEvent.pipe(takeUntilDestroyed()).subscribe(() => {
this.isComposing = true;
this._isComposing = true;
});

compositionEndEvent.pipe(takeUntilDestroyed()).subscribe(() => {
this.isComposing = false;
this._isComposing = false;
this.inputText = this._elementRef.nativeElement.value;
});
});
Expand All @@ -110,7 +110,7 @@ export class AutoCompleteDirective {

/** @hidden */
_handleKeyboardEvent(event: KeyboardEvent): void {
if (this.enable && !this.isComposing) {
if (this.enable && !this._isComposing) {
if (KeyUtil.isKeyCode(event, this._stopKeys)) {
this._elementRef.nativeElement.value = this.inputText;
} else if (KeyUtil.isKeyCode(event, this._completeKeys)) {
Expand Down

0 comments on commit 4b8552e

Please sign in to comment.