Floating-label on p-autocomplete unfloating after selection
I'm submitting a ... (check one with "x")
[ x ] bug report
[ ] feature request
[ ] support request
Plunkr Case (Bug Reports) PrimeNG 4.2.0: http://plnkr.co/edit/nSHT6iIkXi5IgRKkRJC3?p=preview
Edit, PrimeNG 4.3.0: http://plnkr.co/edit/bYQgsuYbgxhL9Y3ceybD?p=preview
Current behavior
As described in issue #4145 (and globally in #4011), the floating-labels are not floating after selecting an item in the dropdownlist, when the dropdown is triggered by the MouseEvent. When selecting an item by triggering an InputEvent, the label keeps floating as it should even when the next event is a MouseEvent. When clearing the selected item using backspace and change the focus to another element, this can be reproduced.
So, in short: if the MouseEventis triggered without an earlier InputEvent (unless the input has been cleared using backspace), the label isn't floating.
Expected behavior The label keeps floating, no matter the eventType.
Minimal reproduction of the problem with instructions
In the Plunkr, you can see there's a <p-autocomplete> with a `(completeMethod)="search($event)"'.
- Trigger the completeMethod in the autocomplete-UI by CLICKING the dropdown-button
- Select an item in the list
- Click away from the autocomplete to lose focus.
Please tell us about your environment:
-
OS: Windows 10 64b
-
IDE: IntelliJ Ultimate 2017.2.5
-
Angular version: 4.4.6
-
PrimeNG version: 4.3.0
-
Browser: All
-
Language: TypeScript 2.0.3
Edit: added reference to original, global, issue.
Works for me on 4.3.0;
<span class="ui-float-label">
<p-autoComplete [(ngModel)]="country" inputId="float-input" [suggestions]="filteredCountriesSingle" (completeMethod)="filterCountrySingle($event)" field="name" [size]="30"
[minLength]="1"></p-autoComplete>
<label for="float-input">Username</label>
</span>
Provide a plunkr on 4.3.0 please;
http://plnkr.co/edit/6q5v84DWolH6DeAdi70w?p=info
@cagataycivici, your code is not triggering the bug because the bug-causing attribute is not present...
My previous Plunkr was on 4.3.0 (checked it in "systemjs.config.js": 'primeng': 'npm:[email protected]' to be sure). Anyways, I created a new Plunkr based on the given URL:
http://plnkr.co/edit/KHw1AJ5legYuFXAcsR6I?p=preview
<span class="ui-float-label">
<p-autoComplete id="foo" [suggestions]="resultsFilter" (completeMethod)="search($event)"
[dropdown]="true">
<ng-template let-resultItems>
<div class="ui-helper-clearfix">
<div>{{resultItems}}</div>
</div>
</ng-template>
</p-autoComplete>
<label for="foo">Never keep floating</label>
</span>
It is NOT working.... your example is NOT using the [dropdown]="true"... if you read the case-description thorough, you'll see that I stated:
the floating-labels are not floating after selecting an item in the dropdownlist, when the dropdown is triggered by the
MouseEvent
@cagataycivici could you please check this out again?
@cagataycivici I can conform it's fixed using PrimeNG5!! Thank you very much for this quick fix!