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

fix(ComboBox): update Enter key handling #18737

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamalston
Copy link
Contributor

@adamalston adamalston commented Mar 2, 2025

Closes #18728

Fixed ComboBox Enter key handling.

Changelog

Changed

  • Fixed ComboBox Enter key handling.

Testing / Reviewing

yarn test packages/react/src/components/ComboBox

A test story can be created by copying and pasting this code in ComboBox.stories.js:

export const _test = (args) => {
  const [invalidText, setInvalidText] = useState('');

  return (
    <div style={{ width: 300 }}>
      <ComboBox
        helperText="Combobox helper text"
        id="carbon-combobox"
        itemToString={(item) => item?.text ?? ''}
        invalid={!!invalidText}
        invalidText={invalidText}
        items={[
          { id: 'option-1', text: 'Option 1' },
          { id: 'option-2', text: 'Option 2' },
          { id: 'option-3', text: 'Option 3' },
        ]}
        onChange={({ selectedItem }) => {
          setInvalidText(selectedItem?.id === 'option-1' ? 'Invalid' : '');
        }}
        onToggleClick={() => {}}
        titleText="ComboBox title"
      />
    </div>
  );
};

Reference commits: 448a2b7...3fbba63

Copy link

netlify bot commented Mar 2, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 381edb2
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/67c466de37c5c70008f05e1e
😎 Deploy Preview https://deploy-preview-18737--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Mar 2, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 381edb2
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67c466de76eb670009c8db4e
😎 Deploy Preview https://deploy-preview-18737--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Mar 2, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 381edb2
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/67c466ded3b70200086af604
😎 Deploy Preview https://deploy-preview-18737--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Mar 2, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.36%. Comparing base (448a2b7) to head (381edb2).

Files with missing lines Patch % Lines
...ackages/react/src/components/ComboBox/ComboBox.tsx 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18737      +/-   ##
==========================================
+ Coverage   84.34%   84.36%   +0.02%     
==========================================
  Files         408      408              
  Lines       14645    14640       -5     
  Branches     4771     4821      +50     
==========================================
- Hits        12352    12351       -1     
+ Misses       2132     2127       -5     
- Partials      161      162       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamalston adamalston marked this pull request as ready for review March 2, 2025 16:48
@adamalston adamalston requested review from a team as code owners March 2, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: ComboBox onChange yields null selectedItem when pressing Enter
1 participant