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: Issue on selecting option using keyboard up/down/enter key when optionValue is provided. #6316

Closed
pradipjs opened this issue Apr 6, 2024 · 4 comments · Fixed by #6374, leoo1992/GeradorQRCode#23 or leoo1992/GeradorQRCode#27
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@pradipjs
Copy link

pradipjs commented Apr 6, 2024

Describe the bug

image
event.option is the value of the option. If we try to get the lable using just a value, it returns null and resets the dropdown to empty.
I think it should have whole option and in "if" condition we should match it using the getOptionValue function by passing the option. That would do the job.

Reproducer

https://stackblitz.com/edit/c8zt2t-9ncxnp?file=src%2FApp.jsx

PrimeReact version

10.6.2

React version

18.x

Language

TypeScript

Build / Runtime

Next.js

Browser(s)

Any

Steps to reproduce the behavior

Simple dropdown with optionValue parameter set.
Try to set value using. the keyboard, on foucs, press enter/tab to open the options. up/down arrow to move & enter to select the option.

Replication video : https://www.awesomescreenshot.com/video/26486438?key=8665b08a05cbc1611bbec00e4273ecb6

Expected behavior

It should select the option. It is currently resetting the dropdown.

@pradipjs pradipjs added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 6, 2024
@melloware melloware added Component: Accessibility Issue or pull request is related to WCAG or ARIA Status: Needs Reproducer Issue needs a runnable reproducer and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Component: Accessibility Issue or pull request is related to WCAG or ARIA labels Apr 6, 2024
Copy link

github-actions bot commented Apr 6, 2024

Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.

@pradipjs
Copy link
Author

pradipjs commented Apr 9, 2024

I have updated the query with reproduce steps.
Here's the reference: https://stackblitz.com/edit/c8zt2t-9ncxnp?file=src%2FApp.jsx

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Reproducer Issue needs a runnable reproducer labels Apr 9, 2024
@melloware
Copy link
Member

Thanks changed it to "Bug"

@shubhsaur
Copy link
Contributor

Hello @melloware, have submitted the PR for this issue

@melloware melloware added this to the 10.6.4 milestone Apr 13, 2024
melloware pushed a commit to shubhsaur/primereact that referenced this issue Apr 13, 2024
melloware added a commit that referenced this issue Apr 13, 2024
…tionValue prop (#6374)

* Fix #6316: fixed issue on selecting option by key event when using optionValue prop

* Update Dropdown.js

---------

Co-authored-by: Shubham Saurabh <[email protected]>
Co-authored-by: Melloware <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment