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

p-dropdown: option displays "empty" when value is 0 (zero) instead of the actual value 0 #12455

Closed
FabienDehopre opened this issue Jan 4, 2023 · 4 comments · Fixed by #12457
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@FabienDehopre
Copy link

Describe the bug

When using an array of numbers for the dropdown options and that one of the values is 0 then the corresponding option displays "empty" instead of the actual value 0.

This is because the template at line 60 uses a || instead of ??.

Environment

N/A

Reproducer

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

Angular version

15.0.4

PrimeNG version

15.0.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.12.1

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to the stackblitz reproduction url provided
  2. Open the dropdown on the preview pane.

Expected behavior

The option shouldn't display "empty" when the value is neither null nor undefined.
Use the optional operator ?? instead of the boolean operator || in the template.

@FabienDehopre FabienDehopre added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 4, 2023
@cetincakiroglu cetincakiroglu 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 Jan 4, 2023
@cetincakiroglu cetincakiroglu added this to the 15.0.2 milestone Jan 4, 2023
cetincakiroglu added a commit that referenced this issue Jan 4, 2023
cetincakiroglu added a commit that referenced this issue Jan 4, 2023
Fixed #12455 - p-dropdown: option displays empty when value is 0 (zer…
@FabienDehopre
Copy link
Author

@cetincakiroglu there is the same issue at line 136 so the bug is not fully resolved...

@likwidgames
Copy link

@cetincakiroglu this is not fixed as of 16.5.0

@cetincakiroglu
Copy link
Contributor

Hi,

We're currently implementing accessibility and as a part of it, we've just reworked and refactored the dropdown component, this bug is fixed currently and the fix will be available in near future. We'll release accessibility implementation for the input components in upcoming weeks.

@NikolaCeh
Copy link

Still present in Angular 17, PrimeNg 17.5.0

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

Successfully merging a pull request may close this issue.

4 participants