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

Dropdown: Floating placeholder overlapping when value is null or undefined. #16411

Closed
Elias-Graf opened this issue Sep 20, 2024 · 0 comments · Fixed by #16421
Closed

Dropdown: Floating placeholder overlapping when value is null or undefined. #16411

Elias-Graf opened this issue Sep 20, 2024 · 0 comments · Fixed by #16421
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Elias-Graf
Copy link
Contributor

Elias-Graf commented Sep 20, 2024

Describe the bug

Let's say you have a dropdown with the following options:

  options: { label: string; value: number | undefined }[] = [
    { label: 'None', value: undefined },
    { label: 'First', value: 0 },
    { label: 'Second', value: 1 },
  ];

If you have a floating label and select the None value, the floating label will overlap with the value like this:
image

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

  1. Open provided reproducer
  2. Select none from the dropdown

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.

@Elias-Graf Elias-Graf added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 20, 2024
@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 18, 2024
@mertsincan mertsincan added this to the 17.18.13 milestone Nov 18, 2024
@mertsincan mertsincan moved this to Done in PrimeNG Dec 9, 2024
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
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants