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 hides when click inside input #2466

Closed
evgd opened this issue Apr 7, 2017 · 1 comment
Closed

AutoComplete hides when click inside input #2466

evgd opened this issue Apr 7, 2017 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@evgd
Copy link

evgd commented Apr 7, 2017

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
https://www.primefaces.org/primeng/#/autocomplete

reproduce

Current behavior
Click on input when input was already in focus forces suggestions panel to hide.

Expected behavior
Suggestion should stay there

  • Angular version: 2.x

  • PrimeNG version: 2.x-4.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

@cagataycivici cagataycivici self-assigned this Apr 12, 2017
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Apr 12, 2017
@cagataycivici cagataycivici added this to the 4.0.RC3 milestone Apr 12, 2017
@cagataycivici cagataycivici changed the title autocomplete hides when click inside input AutoComplete hides when click inside input Apr 12, 2017
@evgd
Copy link
Author

evgd commented Apr 12, 2017

thanks!
to whom are not on master following code can be used as temporary patch:

@Component({
...
})
export class XyzComponent implements AfterViewInit, OnDestroy {

    @ViewChild(AutoComplete)
    public autocompleteComponent: AutoComplete;
	
	private unsubscribeOnDestory;

    public ngAfterViewInit() {
        this.autocompleteComponent.documentClickListener();
        this.unsubscribeOnDestory = this.renderer.listenGlobal('body', 'click', (evt: Event) => {
            if (evt.target === this.autocompleteComponent.inputEL.nativeElement) {
                return;
            }

            this.autocompleteComponent.hide();
        });
    }

    public ngOnDestroy() {
        this.unsubscribeOnDestory();
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants