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

Pre-selecting items in ComboBox does not work in v7.15 #6420

Closed
1 of 2 tasks
flannanl opened this issue Jul 9, 2020 · 0 comments · Fixed by #6427
Closed
1 of 2 tasks

Pre-selecting items in ComboBox does not work in v7.15 #6420

flannanl opened this issue Jul 9, 2020 · 0 comments · Fixed by #6427
Assignees
Labels
component: combobox package: react carbon-components-react severity: 1 https://ibm.biz/carbon-severity type: bug 🐛

Comments

@flannanl
Copy link

flannanl commented Jul 9, 2020

What package(s) are you using?

carbon-components-react

  • carbon-components
  • carbon-components-react

Detailed description

Describe in detail the issue you're having.
I am using initialSelectedItem prop to pass the initial selection to the ComboBox component. It was working in v7.12. But since I moved up to v7.15, it no longer works. The input field is set to the label of the pre-selected item, but if I open the dropdown, I don't see the pre-selected item is highlighted. Then when the component lost the focus, the text in the combo input field will be clear.

Is this issue related to a specific component?
Yes, ComboBox component.

What did you expect to happen? What happened instead? What would you like to
see changed?
I expect the pre-selected item will be persisted and opening the dropdown will see the item highlighted.

What browser are you working in?
Chrome

What version of the Carbon Design System are you using?
carbon-components v10.15
carbon-components-react v7.15

What offering/product do you work on? Any pressing ship or release dates we
should be aware of?
IBM Cloud Console. This is a regression and it should be fixed as soon as possible.

Steps to reproduce the issue

  1. Step one
    Render the component like the code snippet attached below.
  2. Step two
    Open the dropdown menu. You will see no item is highlighted.
  3. Step three
    Click elsewhere to make the component lose focus.
  4. Results
    The text in the input field is clear and nothing is highlighted in the dropdown.

Please create a reduced test case in CodeSandbox

Additional information

  • Screenshots or code
    Code snippet:
          <ComboBox
            id="my-id"
            items={['aaa', 'bbb', 'ccc']}
            initialSelectedItem={'bbb'}
            light
          />

combobox-bug

  • Notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: combobox package: react carbon-components-react severity: 1 https://ibm.biz/carbon-severity type: bug 🐛
Projects
None yet
2 participants