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]: Fully controlled ComboBox (with selectedItem and onChange provided) does not properly update value #16565

Closed
2 tasks done
pedesen opened this issue May 24, 2024 · 2 comments · Fixed by #17527
Closed
2 tasks done

Comments

@pedesen
Copy link

pedesen commented May 24, 2024

Package

@carbon/react

Browser

Firefox

Package version

1.58.0

React version

18.3.1

Description

There are issues when ComboBox is used as a fully controlled input (meaning with selectedItem and onChange props provided):

  • onChange is not called in some situations
  • ComboBox is not cleared when selectedItem changes to null

(see steps to reproduce for details)

This worked with v1.57.0 and stopped working with v1.58.0

Reproduction/example

https://stackblitz.com/edit/github-w7mkre?file=src%2FApp.jsx

Steps to reproduce

Given: a fully controlled ComboBox component (meaning with selectedItem and onChange props provided):

Bug 1

  • change selectedItem prop programmatically to null (click separate "Reset" button in example)

Problem:

  • combo box value is not cleared

Bug 2

  • Provide selectedItem prop
  • Click the "clear selected item" button (x) inside the ComboBox

Problem:

  • onChange is not triggered (no console output in example)

Workarounds

For bug 1 there might be a workaround by providing a "key" prop which forces the ComboBox to re-render when selectedItem changes to null. But for bug 2 I wasn't able to find a workaround.

Suggested Severity

Severity 2 = User cannot complete task, and/or no workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

github-merge-queue bot pushed a commit to camunda/camunda that referenced this issue May 24, 2024
## Description

This reverts the [dependency update of
@carbon/react](#18734) for
Operate due to bugs introduced by Carbon's ComboBox component. This bug
caused several frontend and E2E tests to fail.

More context:
carbon-design-system/carbon#16565
github-merge-queue bot pushed a commit to camunda/camunda that referenced this issue May 24, 2024
## Description

This reverts the [dependency update of
@carbon/react](#18734) for
Operate due to bugs introduced by Carbon's ComboBox component. This bug
caused several frontend and E2E tests to fail.

More context:
carbon-design-system/carbon#16565
github-merge-queue bot pushed a commit to camunda/camunda that referenced this issue May 24, 2024
## Description

This reverts the [dependency update of
@carbon/react](#18734) for
Operate due to bugs introduced by Carbon's ComboBox component. This bug
caused several frontend and E2E tests to fail.

More context:
carbon-design-system/carbon#16565
github-merge-queue bot pushed a commit to camunda/camunda that referenced this issue May 24, 2024
## Description

This reverts the [dependency update of
@carbon/react](#18734) for
Operate due to bugs introduced by Carbon's ComboBox component. This bug
caused several frontend and E2E tests to fail.

More context:
carbon-design-system/carbon#16565
github-merge-queue bot pushed a commit to camunda/camunda that referenced this issue May 24, 2024
## Description

This reverts the [dependency update of
@carbon/react](#18734) for
Operate due to bugs introduced by Carbon's ComboBox component. This bug
caused several frontend and E2E tests to fail.

More context:
carbon-design-system/carbon#16565
github-merge-queue bot pushed a commit to camunda/camunda that referenced this issue May 24, 2024
## Description

This reverts the [dependency update of
@carbon/react](#18734) for
Operate due to bugs introduced by Carbon's ComboBox component. This bug
caused several frontend and E2E tests to fail.

More context:
carbon-design-system/carbon#16565
github-merge-queue bot pushed a commit to camunda/camunda that referenced this issue May 24, 2024
## Description

This reverts the [dependency update of
@carbon/react](#18734) for
Operate due to bugs introduced by Carbon's ComboBox component. This bug
caused several frontend and E2E tests to fail.

More context:
carbon-design-system/carbon#16565
@Gururajj77
Copy link
Contributor

Will look into this issue once this #17324 PR's work is in, so that problem on this can be more refined before we begin to work on this.

@H31nz3l
Copy link

H31nz3l commented Oct 3, 2024

We encountered the same issue, specifically with the 'ComboBox' not clearing when the selectedItem is set to null. After updating to version @carbon/react ^1.67.1, the problem seems to be resolved."

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