carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.86k stars 1.82k forks source link

[Bug]: Combobox fires its onInputChange callback on initial render #16969

Open markcor11 opened 4 months ago

markcor11 commented 4 months ago

Package

@carbon/react

Browser

Chrome, Safari, Firefox

Package version

v1.61.0

React version

16.14.0

Description

When a combobox first renders, the onInputChange callback fires. Shouldn't the onInputChange only fire when the user has typed a new value into the text box.

sample: https://codesandbox.io/s/staging-sea-r87r62?file=/src/index.js:737-750

Notice on render, the console tab shows the onInputChange fires

Reproduction/example

https://codesandbox.io/s/staging-sea-r87r62?file=/src/index.js:737-750

Steps to reproduce

Open this app: https://codesandbox.io/s/staging-sea-r87r62?file=/src/index.js:737-750

Look at the debug console to confirm the console.log state fires showing the callback was triggered.

Suggested Severity

None

Application/PAL

Event Integration (EEM)

Code of Conduct

ashishkrz commented 4 months ago

One more issue with ComboBox, when an item is selected, and you try to clear it out by clicking (x) icon, it doesn't get cleared.