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

Typeahead dropdown not showing on key stroke in Android Chrome/FF #1296

Closed
diogen737 opened this issue Aug 1, 2019 · 9 comments
Closed

Typeahead dropdown not showing on key stroke in Android Chrome/FF #1296

diogen737 opened this issue Aug 1, 2019 · 9 comments

Comments

@diogen737
Copy link

diogen737 commented Aug 1, 2019

Describe the bug
Hi! Appreciate your lib very much but I'm having a little trouble with typeahead feature. Hope you could help me here.

Here's my setup which is pretty standard:

<ng-select [ngModel]="[]"
           [items]="tags$ | async"
           [typeahead]="tagsSubject$"
           [bindLabel]="'fondname'"
           [addTag]="false"
           [multiple]="true"
           [hideSelected]="true"
           [trackByFn]="tagsTrackByFn"
           [loading]="tagsLoading"
           [disabled]="disableTagsInput"
           [clearable]="false"
           [clearOnBackspace]="false"
           [placeholder]="'Search: Name, ISIN, Ticker'"
           (add)="tagAdded($event)"
           (remove)="tagRemoved($event.value)">
</ng-select>

public tags$: Observable<EtfQuickSearchProduct[]>;
public tagsSubject$ = new Subject<string>();

this.tags$ = this.tagsSubject$
      .pipe(
          tap(() => this.tagsLoading = true),
          debounceTime(500),
          distinctUntilChanged(),
          switchMap(query => this.dataService.quickSearchRequest(query, 5)),
          map(data => data.count ? data.results : []),
          tap(() => this.tagsLoading = false),
          catchError(() => of([])),
      );

Everything works just fine on desktop Chrome, Firefox, Safari and on iOS Safari.
But on Android Chrome and Firefox typeahead doesn't work as expected. tagsSubject$ pipe is firing only after blurring input or entering 'space' symbol, not after last letter entered. Hitting 'Enter' also doesn't help.

Expected behavior
On Android Chrome/FF dropdown should API call should fire and dropdown should appear after letter is entered.

I suspect it has something to do with ComposeStart/ComposeEnd/Input event for inner input.

Screenshots
Screenshot_20190801-222814
Screenshot_20190801-222844

Smartphone (please complete the following information):

  • Device: OnePlus 5
  • OS: Android 8.1.0
  • Browser Chrome 75.0.3770.143

Additional context

  • Angular: 8.1.2
  • ng-select: 3.0.5
@issue-label-bot issue-label-bot bot added the bug label Aug 1, 2019
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.82. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@diogen737
Copy link
Author

update: downgrading to ng-select@3.0.4 solves the problem

@varnastadeus
Copy link
Member

from the screens, I can see that you are in some sort of composition mode that's why ng-selects waits until you will leave it. FYI - on my android with a regular keyboard it works as expected

@diogen737
Copy link
Author

@varnastadeus changing keyboard from Google Keyboard to Swift also solves problem. But I cannot tell all my users to switch keyboard 😃

@me-amit
Copy link

me-amit commented Aug 8, 2019

@diogen737 ,
I am also facing same issue on android. You got any workaround for it.
I have created a stack-blitz. Please open it on mobile and check to verify the issue.
stack-blitz

On mobile if we type and clear the text then it is showing but not showing while seaching only no items.
I am working on angular 6 "@ng-select/ng-select": "2.20.5"

Smartphone (please complete the following information):

Device: Realme 3 Pro
OS: Android 9
Browser Chrome 76.0.3809.89
Additional context

ng-select-vs
ng-select

@achimha
Copy link

achimha commented Oct 12, 2019

Any idea how to fix this other than downgrading ng-select?

@andreo-k
Copy link

andreo-k commented Oct 23, 2019

this ugly workaround works

      <ng-select [items]="dataService.regions$ | async"
                 bindLabel="text"

                 [addTag]="false"
                 [multiple]="true"
                 [hideSelected]="true"
                 placeholder="Regions"
                 clearAllText="Cleanup"
                 notFoundText="Not found"
                 typeToSearchText="Start typing"
                 [loading]="loading"
                 (keydown)="rergionKeyDown($event)"
                 [typeahead]="dataService.regionName$"
                 (change)="regionChanged($event)"
                 [(ngModel)]="regions">

and in code

rergionKeyDown(e) {
this.dataService.regionName$.next(e.target.value);
}

@github-actions
Copy link

github-actions bot commented Nov 3, 2019

🎉 This issue has been resolved in version 3.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lauramuoz1993
Copy link

The version "@ng-select/ng-select": "~2.16.0" it's the option.

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

No branches or pull requests

6 participants