Dropdown: Floating placeholder overlapping when value is null
or undefined
.
#16411
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
Let's say you have a dropdown with the following options:
If you have a floating label and select the
![image](https://private-user-images.githubusercontent.com/46671625/369461802-33edbeb9-d3a9-4b4a-a9fc-0a26807e778f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTExMTksIm5iZiI6MTczOTY5MDgxOSwicGF0aCI6Ii80NjY3MTYyNS8zNjk0NjE4MDItMzNlZGJlYjktZDNhOS00YjRhLWE5ZmMtMGEyNjgwN2U3NzhmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE2VDA3MjY1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI0NDYyNzYzNjRjNzA1ODhjZDA5N2RiOTI0YmY5N2I4YzIxNmRmYjA2OGJmOTE1MDBjOGY3MWY5YTEyNDg1MzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.STllgA85FD0_TxGlmXBmBREpLa7m5K98rbe1wMrjFaI)
None
value, the floating label will overlap with the value like this:Most likely this is because of this check, that is comparing if the value is something, instead of checking if an option is selected:
https://github.com/primefaces/primeng/blob/ae58a4948ac6225e053641e7462a5f787be28e48/src/app/components/dropdown/dropdown.ts#L1012C1-L1015C8
Most likely the issue would be solved, if the same code is used as for:
https://github.com/primefaces/primeng/blob/ae58a4948ac6225e053641e7462a5f787be28e48/src/app/components/dropdown/dropdown.ts#L1002C1-L1010C8
Environment
Not applicable, otherwise please let me know.
Reproducer
https://stackblitz.com/edit/github-epdzxk?file=src%2Fapp%2Fapp.component.html
Angular version
17.x.x
PrimeNG version
^17.18.10
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v18.20.3
Browser(s)
Firefox, Chrome
Steps to reproduce the behavior
Expected behavior
Label should be floating when an option is selected. It should only not be floating, if the current selected value is not an option, e.g.: no option is selected.
The text was updated successfully, but these errors were encountered: