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

Autocomplete Japanese input support for Chrome on Mac - 12.3 #12341

Merged
merged 7 commits into from Nov 21, 2022
Merged
Expand Up @@ -781,6 +781,15 @@ describe('IgxAutocomplete', () => {
fixture.detectChanges();
expect(input.nativeElement.attributes['aria-expanded'].value).toEqual('false');
}));
it('Should accept Japanese input', fakeAsync(() => {
UIInteractions.setInputElementValue(input, '東京', fixture);
fixture.detectChanges();
tick();
UIInteractions.triggerKeyDownEvtUponElem('enter', input.nativeElement, true);
fixture.detectChanges();
expect(input.value).toBe('東京');
}
));
});
describe('Positioning settings tests', () => {
it('Panel settings - direction and startPoint: top', fakeAsync(() => {
Expand Down
Expand Up @@ -211,6 +211,7 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
return 'list';
}

protected _composing: boolean;
protected id: string;
protected get model() {
return this.ngModel || this.formControl;
Expand All @@ -234,6 +235,20 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
this.open();
}

/** @hidden @internal */
@HostListener('compositionstart')
public onCompositionStart(): void {
if (!this._composing) {
this._composing = true;
}
}

/** @hidden @internal */
@HostListener('compositionend')
public onCompositionEnd(): void {
this._composing = false;
}

/** @hidden @internal */
@HostListener('keydown.ArrowDown', ['$event'])
@HostListener('keydown.Alt.ArrowDown', ['$event'])
Expand All @@ -253,7 +268,7 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective

/** @hidden @internal */
public handleKeyDown(event) {
if (!this.collapsed) {
if (!this.collapsed && !this._composing) {
switch (event.key.toLowerCase()) {
case 'space':
case 'spacebar':
Expand Down