-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 remains in focus with forceSelection #4298
Comments
I see same problem, focus not leaving |
I can confirm the problem with 4.3 RC2 |
I have same issue. Please find the plnkr. Its holding my project. Can you tell me the workaround please? <p-autoComplete [(ngModel)]="seletedProject" |
The same problem with 4.3.0: focus is not leaving when value is selected for autocomplete in Force Selection mode. Only way to "tab" from the control is to clear it's input. Plnkr: http://plnkr.co/edit/C7b0lSV30CRk496KomWx?p=preview P.S. the interesting point is: when |
Yap, yes, here is the problem: and here: https://github.com/primefaces/primeng/blob/master/src/app/components/autocomplete/autocomplete.ts#L359 this method returns focus to the input :(( fix needed |
is this issue fixed with forceselection=true? |
As this issue is fixed in PrimeNG 5.0.0-RC0 [Angular v5], But still this is an issue for those who using Angular v4. |
Agreed with @faizu88 |
The implementation is not correct in my opinion (as mentioned above ) whenever forceselection is set to true and you have made a selection this makes this implementation useless in any form with just an autocomplete and a submit button, (users might think the submit button is not working) I've sold this issue for the moment by resetting the suggestions to undefined so that this line is evaluated false. Hope this might help for other people ps my suggestions are from a http call, others might have predefined suggestions, so for them a different solution might be found
|
confirmed that updating primeNG to ^5.0.0 when experiencing this bug using Angular 5 fixed this for me. |
I had the same issue and can confirm as well that upgrading to PrimeNG 5.0.2 (^5.0.0) fixed this issue :) |
Hi, thank your for this great lib, Is there any solution for those are stuck on version 4 of Angular ? |
A workaround for this issue is to make an onBlur method in your component, that will disable the component, and enable it again in the next event loop. This will force the element to get unfocused, since you cannot focus a disabled input, and then re-enable it, to make it focusable again. Sample code: public disabled = false;
...
onBlur() {
this.disabled = true;
setTimeout(() => (this.disabled = false));
} <p-autoComplete [disabled]="disabled" (onBlur)="blur()"> |
Another solution (the proper one, not a hacky one) is to clear your suggestions in the |
I'm submitting a ... (check one with "x")
Current behavior
I have a user story where the autocomplete input becomes readonly after selection (onSelect)
With the latest 4.3 X release that input field remains on focus meaning the whole form (whole page) becomes unselectable
Expected behavior
Autocomplete should get out of focus .. this.onfocus=false; when input element is in readmode
Maybe a code can be added with onblur or onselect that checks if the input element is in readmode (or maybe also disabled)
If that is the case then this.onfocus = false
ps maybe the onInputBlur is never called when a input element is in readonly
thanks
The text was updated successfully, but these errors were encountered: