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]: Controlled ComboBox onStateChange calling onChange with selectedItem as 'undefined' #18286

Open
2 tasks done
simson1 opened this issue Jan 1, 2025 · 0 comments
Open
2 tasks done
Assignees

Comments

@simson1
Copy link

simson1 commented Jan 1, 2025

Package

@carbon/react

Browser

Chrome

Package version

1.72.0

React version

19.0.0

Description

  • onStateChange of combobox receive changes as a function parameter. onStateChange?: (changes: UseComboboxStateChange<Item>) => void
  • changes object can't have selectedItem as a property all the time.
  • So, It is passing undefined as a selectedItem for steps mentioned below.

Reproduction/example

https://stackblitz.com/edit/github-zurxxwnj?file=src%2FApp.jsx,package-lock.json&preset=node=

Steps to reproduce

  1. Select value '1' from combobox.
  2. Click on combobox and remove value '1' with backspace/delete.
  3. Now click on MenuItem with value '1'.
  4. combobox input value becomes empty.

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: ⏱ Backlog
Development

No branches or pull requests

3 participants