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

feat: combobox's new feature, autocomplete with typeahead #17268

Merged

Conversation

Gururajj77
Copy link
Contributor

@Gururajj77 Gururajj77 commented Aug 26, 2024

Closes #14007

Added autocomplete and typeahead feature for combobox with custom filter to support the typeahead.

Changelog

New

  • new autocomplete prop
  • new autocompleteCustomFunction which is 1-to-1 mapping filter function which filters matching both character and position.
  • new test to make sure autocomplete and autocompleteCustomFunction are working.

Changed

  • added getMenuProps and refs.setFloationg to useMemo hook
  • modified import for act in the test helpers

Testing / Reviewing

  • navigate to new "Autocomplete with Typeahead" story
  • check that the suggestions are coming in the input box or not.

Copy link

netlify bot commented Aug 26, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ec3ca65
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/67054fb173e3d0000972fcc9
😎 Deploy Preview https://deploy-preview-17268--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

netlify bot commented Aug 26, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit ec3ca65
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67054fb173493c000803482d
😎 Deploy Preview https://deploy-preview-17268--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
Member

@kennylam kennylam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gururajj77 Are there design specs for the functionality of this new feature? I think in matching 1:1 with the filtering behavior, autocomplete is too aggressive and unpredictable. Unless users know exactly when to stop typing, extra characters get inserted into the matching string. If users try to delete the text, the autocomplete can insert other matching strings (try deleting apple), or even prevent them from deleting at all (try deleting banana). Using the clear (x) button also doesn't always clear the text. The only reliable way is to select all and delete.

Sep-09-2024.09-23-29.mp4

packages/react/src/components/ComboBox/ComboBox.tsx Outdated Show resolved Hide resolved
packages/react/src/components/ComboBox/ComboBox.tsx Outdated Show resolved Hide resolved
@2nikhiltom 2nikhiltom requested a review from a team as a code owner September 11, 2024 13:10
Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few things we discussed in our review pairing session today

packages/react/src/components/ComboBox/ComboBox.tsx Outdated Show resolved Hide resolved
packages/react/src/components/ComboBox/ComboBox.tsx Outdated Show resolved Hide resolved
packages/react/src/components/ComboBox/ComboBox.tsx Outdated Show resolved Hide resolved
packages/react/src/components/ComboBox/ComboBox.tsx Outdated Show resolved Hide resolved
Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few extra things on the tests

packages/react/src/components/ComboBox/ComboBox-test.js Outdated Show resolved Hide resolved
packages/react/src/components/ComboBox/ComboBox-test.js Outdated Show resolved Hide resolved
@Gururajj77 Gururajj77 requested a review from thyhmdo September 18, 2024 06:49
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.19%. Comparing base (df9ec56) to head (ec3ca65).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17268      +/-   ##
==========================================
+ Coverage   77.08%   77.19%   +0.11%     
==========================================
  Files         409      409              
  Lines       14024    14076      +52     
  Branches     4327     4344      +17     
==========================================
+ Hits        10810    10866      +56     
+ Misses       3043     3039       -4     
  Partials      171      171              

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

@tay1orjones
Copy link
Member

I also tried to use this with allowCustomValue but with the existing bugs on allowCustomValue it's hard to know if there's any interaction. Is it worth adding some tests to cover autocomplete with allowCustomValue on.

Copy link
Member

@thyhmdo thyhmdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@Gururajj77 Gururajj77 added this pull request to the merge queue Oct 9, 2024
Merged via the queue into carbon-design-system:main with commit 7776f11 Oct 9, 2024
36 checks passed
@Gururajj77 Gururajj77 deleted the autocomplete-with-typeahead branch October 9, 2024 14:06
@carbon-automation
Copy link
Contributor

Hey there! v11.68.0 was just released that references this issue/PR.

annawen1 pushed a commit to annawen1/carbon that referenced this pull request Oct 11, 2024
…ign-system#17268)

* feat: autocomplete is fked

* feat: autoComplete typeahead feature fixed

* feat: added tests for autocomplete

* feat: adds functionality test cases

* feat: matcsh case exactly with option list when Tab is pressed

* feat: adds tests, refines functions

* feat: updated prop name to component and tests

* refactor: fixed conflict

* test: covered allowcustomValue prop

---------

Co-authored-by: Nikhil Tomar <[email protected]>
Co-authored-by: Nikhil Tomar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[ComboBox] Autocomplete implementation
5 participants