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

[Bug]: Combobox triggering onChange with previous value before updating the user selected value #18386

Open
2 tasks done
Gururajj77 opened this issue Jan 21, 2025 · 0 comments
Assignees

Comments

@Gururajj77
Copy link
Contributor

Package

@carbon/react

Browser

Chrome

Package version

V11

React version

v18

Description

When we use keyboard to interact with the combobox and select an item and after that we select another item again, it is calling the onChange 2 times

  • First onChange fired with the previous selected value
  • Second onChange fired with newly selected value

Reproduction/example

https://stackblitz.com/edit/github-ultftvd8?file=src%2FApp.jsx&preset=node=

Steps to reproduce

specifically use keyboard interactions to reproduce this:

  • open the console to see the logs
  • Tab into the combobox and select item '2'
  • see that it logs:
null 'selectedItem'
null 'selectedItem'
2 selectedItem
  • after that, select item '3'
  • see that it logs:
2 selectedItem
3 selectedItem

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In Progress
2 participants