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

feat(typeahead): optionally do not hide the results on blur #2059

Closed
NKjoep opened this issue Jun 13, 2017 · 10 comments · Fixed by GulajavaMinistudio/ngx-bootstrap#136
Closed

Comments

@NKjoep
Copy link

NKjoep commented Jun 13, 2017

I couldn't find any issue related to the onblur, so I am creating this.
the current src code:

@HostListener('blur')
public onBlur(): void {
  if (this._container && !this._container.isFocused) {
    this.typeaheadOnBlur.emit(this._container.active);
    this.hide();
  }
}

I would expect a configuration option whether hide or not the results.

@valorkin
Copy link
Member

lost focus -> hide results
why not? ( what is your use case? )

@NKjoep
Copy link
Author

NKjoep commented Jun 13, 2017

So the use case is with mobile browsers. If you want to just 'hide' the virtual keyboard with iOS Safari, you have to tap the 'close/end' toggler in the keyboard itself.

That is enough to trigger the blur event from the input and then you lose also the results.

I think can be useful to better control the user interaction. (there are also some other example with desktop, when you have two lists, when you need to compare something static with something dynamic etc)

@cyberdante
Copy link

In my case, the typeaheadOnBlur is not being triggered at all. Has someone else had this issue?

.html:

<div class="col-lg-12">
    <label class="control-label">Select an Entity:</label>
    <input tabindex="{{tabIndex}}"
           [(ngModel)]="model"
           [typeahead]="entities"
           [typeaheadOptionField]="'display'"
           typeaheadOptionsLimit="{{maxElementsDisplayed}}"
           typeaheadMinLength="{{minLength}}"
           (typeaheadOnSelect)="typeaheadOnSelect($event)"
           (typeaheadNoResults)="changeTypeaheadNoResults($event)"
           (typeaheadOnBlur)="typeaheadOnBlur($event)"
           class="form-control">
</div>

.ts:

//...
constructor(private _entityEvents: EntityEvent) {
    // ...
}
public typeaheadOnBlur(e: TypeaheadMatch): void {
        let item: Entity = e.item || e;
        this._entityEvents.onEntityBlurEvent.emit(item);
}

@karthikv-26
Copy link

karthikv-26 commented Sep 20, 2017

@cyberdante typeaheadOnBlur will be triggered only if you have matching results. If no matching results typeaheadNoResults will be triggered. Hope this helps.

@cyberdante
Copy link

cyberdante commented Sep 20, 2017

@valorkin @karthikv-26 when you have already selected a value from the matching result, the matching result list is closed and the focus is on the input where that value is displayed, I would expect that the typeaheadOnBlur is triggered (as the input is part of the component) if I tab out or click outside of the component.

@NKjoep
Copy link
Author

NKjoep commented Nov 8, 2017

Hello :) Why prio low? I think impacts heavily the UX.

This hide on blur feature affects mobile devices because of the onscreen keyboard: when the results list is longer than the screen, users usually immediately close the onscreen keyboard and then the results are gone.

I really hope this feature will be out soon. Also at the end is just a kill-switch for the internal onblur listener.

@IlyaSurmay
Copy link
Contributor

@NKjoep you're right, this is easy to fix. For now we just have more important stuff to do (compatibility, performance etc). You can create PR with this enhancement and we'll probably merge it and include this feature in the next release.

@valorkin
Copy link
Member

valorkin commented Nov 9, 2017

@NKjoep bugs and perf issues are hight prio at the moment
enchantments and new features are lower prio
cuz eager to release v2 asap

@valorkin valorkin removed the question label Dec 4, 2017
@1-0-1
Copy link

1-0-1 commented Jan 3, 2018

Right now there is no way to close the dropdown without selecting on option. Clicking outside calls typeaheadOnBlur but then the dropdown doesn't close.

@YevheniiaMazur YevheniiaMazur changed the title Typeahead: optionally do not hide the results on blur feat(typeahead): optionally do not hide the results on blur Jan 16, 2018
@aguskianto
Copy link

I face the same issue. no matching value and dropdown is not hidden.

Is there any work around for this?

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

Successfully merging a pull request may close this issue.

9 participants