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: Loses value if value changed via ENTER key #6058

Open
KRONTri opened this issue Feb 29, 2024 · 4 comments · Fixed by #6703, leoo1992/GeradorQRCode#57 or leoo1992/GeradorQRCode#80 · May be fixed by nhattpn/BTL_LTNC#56
Open

Dropdown: Loses value if value changed via ENTER key #6058

KRONTri opened this issue Feb 29, 2024 · 4 comments · Fixed by #6703, leoo1992/GeradorQRCode#57 or leoo1992/GeradorQRCode#80 · May be fixed by nhattpn/BTL_LTNC#56
Labels
Component: Accessibility Issue or pull request is related to WCAG or ARIA Type: Bug Issue contains a defect related to a specific component.

Comments

@KRONTri
Copy link

KRONTri commented Feb 29, 2024

Describe the bug

Dropdown is empty as onChange event value property gets undefined if Dropdown has optionValue set.

Note:
In the stackblitz I created two dropdowns. One with optionValue and one without. The one without is working as expected.

Reproducer

https://stackblitz.com/edit/vitejs-vite-tawz4r?file=src%2FApp.tsx

PrimeReact version

10.5.1

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Chrome 121

Steps to reproduce the behavior

  1. Open dropdown (via mouse or tabbing)
  2. Select a value with cursor keys
  3. Press ENTER

Expected behavior

After pressing ENTER value change should be reflected.

@KRONTri KRONTri 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 29, 2024
@melloware melloware added Component: Accessibility Issue or pull request is related to WCAG or ARIA Type: Bug Issue contains a defect related to a specific component. 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 29, 2024
@melloware
Copy link
Member

Similar to: #6035 Probably a similar fix is needed.

@espentveit
Copy link

Got the same issue. Seems to be that getOptionValue is called twice, where the result of the first is passed to the second. Causing it to not find the value.

Call stack:
selectItem <- getOptionValue is called here
onOptionSelect <- getOptionValue is called here
onEnterKey
onInputKeyDown

@sja-cslab
Copy link
Contributor

sja-cslab commented May 27, 2024

@melloware seems not to be similar.
You fixed #6035 in #6036 but this problem here is still there in 10.6.6

GabriellDatacamp pushed a commit to GabriellReis14/primereact that referenced this issue May 29, 2024
@melloware melloware added this to the 10.7.0 milestone May 29, 2024
melloware added a commit that referenced this issue May 29, 2024
…6703)

* Fix: Remove setTokens in onPaste on InputOtp to avoid duplicate values

- When pasted the value into InputOtp, was duplicating the value, as the state was updated in onPaste and onInput

* Update InputOtp.js

* Fix #6058 Dropdown: Select value with Enter when optionValue is set

---------

Co-authored-by: Datacamp <sistemas@datacamp.net.br>
Co-authored-by: Melloware <mellowaredev@gmail.com>
Co-authored-by: Gabriell Reis Alvarenga <69462016+GabriellReis14@users.noreply.github.com>
melloware added a commit to melloware/primereact that referenced this issue Jul 14, 2024
@melloware melloware removed this from the 10.7.0 milestone Jul 14, 2024
@melloware melloware reopened this Jul 14, 2024
@melloware
Copy link
Member

Reverting this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment