Gbuomprisco / ngx-chips

Tag Input component for Angular
MIT License
899 stars 360 forks source link

Autocomplete works wrong with down arrow button. #925

Open Bulat-Almukhametov opened 4 years ago

Bulat-Almukhametov commented 4 years ago

Current behavior I type text and press down arrow. It selects first item and after few seconds refresh dropdown list. I select item again.

Expected behavior It shouldn't refresh list when I press arrow button.

Minimal reproduction of the problem with instructions (if applicable) Examples from your demo (https://angular-mfppay.stackblitz.io): "Tags within an autocomplete component", "Tags accepting only items from an autocomplete using an observable and showing dropdown without entering text".

I suppose adding condition to this function could help:

TagInputForm.prototype.onKeyDown = function ($event) {
        if ($event.key.indexOf("Arrow") == -1) {
            this.inputText = this.value.value;
            if ($event.key === 'Enter') {
                this.submit($event);
            }
            else {
                return this.onKeydown.emit($event);
            }
        }
    };

What do you use to build your app?. Please specify the version "@angular/cli": "~6.0.0"

Angular version: "@angular/animations": "6.1.10", "@angular/common": "6.1.10", "@angular/compiler": "6.1.10", "@angular/core": "6.1.10", "@angular/forms": "6.1.10", "@angular/http": "6.1.10", "@angular/platform-browser": "6.1.10", "@angular/platform-browser-dynamic": "6.1.10", "@angular/platform-server": "6.1.10", "@angular/router": "6.1.10", "aspnet-prerendering": "^3.0.1", "core-js": "^2.5.4", "hammerjs": "^2.0.8", "jquery": "^3.4.1", "popper.js": "^1.14.3", "rxjs": "^6.0.0", "zone.js": "^0.8.26",

ngx-chips version: "ngx-chips": "^2.1.0"