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: Filtering all items incorrectly clears the dropdown's selected value #14596

Closed
rosenthalj opened this issue Jan 19, 2024 · 0 comments · Fixed by #14665 or #14768
Closed

p-dropdown: Filtering all items incorrectly clears the dropdown's selected value #14596

rosenthalj opened this issue Jan 19, 2024 · 0 comments · Fixed by #14665 or #14768
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rosenthalj
Copy link
Contributor

rosenthalj commented Jan 19, 2024

Describe the bug

For a p-dropdown that is configured with a filter, when a user filters all option values, the selected dropdown item is also incorrectly cleared

The video listed below demonstrates the issue. In the video, only the filter is changed but the dropdown's selected value automatically changes between the"actual" selected value and an empty value

DropdownFilterBug.mov

Environment

windows and macos

Reproducer

https://stackblitz.com/edit/vr5hjz-6e41od

Angular version

17.x

PrimeNG version

17.3.3

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.18.1

Browser(s)

safari, chrome, firefox

Steps to reproduce the behavior

  1. Run the reproducer: https://stackblitz.com/edit/vr5hjz-6e41od
  2. Click on the dropdown
    -- The dropdown option item list is displayed with a filter field (good)
  3. Enter "XX" in the dropdown filter field
    -- The dropdown selected item is automatically cleared (bad)
  4. Click outside the dropdown
    -- The dropdown option item list is not displayed (good)
    -- The dropdown selected item is still cleared (bad)

Expected behavior

For all steps, the dropdown selected item should not be empty and should be "France"

@rosenthalj rosenthalj 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 19, 2024
This was referenced Jan 19, 2024
@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 Feb 1, 2024
@cetincakiroglu cetincakiroglu added this to the 17.5.0 milestone Feb 1, 2024
cetincakiroglu added a commit that referenced this issue Feb 1, 2024
Fix #14596 - fixes p-dropdown logic for selectedOption and label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment