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

Component: p-Dropdown placeholder/values not displayed #14695

Closed
asithade opened this issue Feb 2, 2024 · 13 comments
Closed

Component: p-Dropdown placeholder/values not displayed #14695

asithade opened this issue Feb 2, 2024 · 13 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@asithade
Copy link

asithade commented Feb 2, 2024

Describe the bug

When using p-dropdown, we've noticed that some of the dropdowns when a value is not selected end up with a short height with no placeholder value set. The weird thing is that not all p-dropdowns are affected -- it's quite random on how it is chosen.

Screen.Recording.2024-02-01.at.10.48.59.PM.mov
Screen.Recording.2024-02-01.at.10.56.22.PM.mov

Environment

I'm expecting the dropdown to either display the current value or the placeholder.

Reproducer

https://stackblitz.com/edit/github-lobmlu?file=src%2Fapp%2Fapp.component.html

Angular version

17.1.1

PrimeNG version

17.4.0 & 17.5.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.19.0

Browser(s)

Brave Version 1.62.153 Chromium: 121.0.6167.85

Steps to reproduce the behavior

No response

Expected behavior

I expected the dropdown to either show the placeholder value or the active value

@asithade asithade added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 2, 2024
@cetincakiroglu cetincakiroglu added this to the 17.6.0 milestone Feb 2, 2024
@asithade asithade changed the title Component: p-Dropdown Component: p-Dropdown placeholder/values not displayed Feb 2, 2024
@stepkillah
Copy link

Same issue, noticed after updating to 17.5

@mdybich
Copy link

mdybich commented Feb 2, 2024

Same issue here, works as expected on 17.4.0 but it's broken on 17.5.0

@Draganlazarev90
Copy link

Also doesn't work with reactive forms, when you set fromcontrol value it doesn't display it

@mastersys-giovanni
Copy link

Same error.

@buchatsky
Copy link

Surprise: it does not work in my project, but it does work in Stackblitz.
Race condition? Nested components?

@mehmetcetin01140 mehmetcetin01140 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 Feb 5, 2024
@jozif001
Copy link

jozif001 commented Feb 5, 2024

same issue after upgrading to primeng version 17.5.0,
using Angular 17.1.0

@Cr3aHal0
Copy link
Contributor

Cr3aHal0 commented Feb 5, 2024

Hello everyone,
asithade I tried binding a formControl(Name) or ngModel (since both are about ControlValueAccessor in backstage) to your p-dropdown and it seems to make the placeholder appear, same for buchatsky example. This is indeed not a fix but it can temporary help you having a proper rendering while PrimeNG team has time to fix it.

Example :

<div [formGroup]="formGroup">
  <p-dropdown
    formControlName="value"
    [options]="options"
    [placeholder]="'Testing Placeholder'"
  ></p-dropdown>
</div>

Ts:

  formGroup = new FormGroup({
    value: new FormControl(),
  });

@davidediak
Copy link
Contributor

yikes this is so bad

@asithade
Copy link
Author

asithade commented Feb 5, 2024

Hello everyone,
asithade I tried binding a formControl(Name) or ngModel (since both are about ControlValueAccessor in backstage) to your p-dropdown and it seems to make the placeholder appear, same for buchatsky example. This is indeed not a fix but it can temporary help you having a proper rendering while PrimeNG team has time to fix it.

Example :

<div [formGroup]="formGroup">
  <p-dropdown
    formControlName="value"
    [options]="options"
    [placeholder]="'Testing Placeholder'"
  ></p-dropdown>
</div>

Ts:

  formGroup = new FormGroup({
    value: new FormControl(),
  });

Unfortunately, all of my inputs are already utilizing reactive form controls, so that fix doesn't work for me 😞

@cetincakiroglu cetincakiroglu self-assigned this Feb 7, 2024
@cetincakiroglu
Copy link
Contributor

Hi,

Thanks a lot for letting me know, the issue is fixed now.

@mdybich
Copy link

mdybich commented Feb 7, 2024

@cetincakiroglu The issue should be closed when the version is released, not when the commit is merged to master branch.

@asithade
Copy link
Author

asithade commented Feb 7, 2024

Works now on the latest release. Thank you!

@Sothecom
Copy link

Hi, this is no longer working in 17.7, should I raise a new issue?

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