segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

Set Autocomplete input value based on selected item when allowOtherValues is true #1506

Closed brandongregoryscott closed 2 years ago

brandongregoryscott commented 2 years ago

Overview

Resolves #1496

This is a small change to update the inputValue state to the selected item when allowOtherValues is set. This issue was only noticeable in uncontrolled instances of the Autocomplete, i.e. one that does not set the selectedItem prop (Default Example on our doc site). The correct value (i.e. the selected item) was being set internally, but the input field was not reflecting it.

I added some tests to cover this behavior as well. React testing library was updated to get rid of some warnings about the v18 createRoot API.

Screenshots (if applicable)

Previous Current
Previous Behavior - Item is selected but not updated as input value Current Behavior - Item is selected and input value reflects selection

Documentation

netlify[bot] commented 2 years ago

Deploy Preview for evergreen-storybook ready!

Name Link
Latest commit d8ccae765d7e67f50c00081d98ce2d9dcbe49c64
Latest deploy log https://app.netlify.com/sites/evergreen-storybook/deploys/63359531c6c3550008c2e529
Deploy Preview https://deploy-preview-1506--evergreen-storybook.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 settings.

rutvij2811 commented 2 years ago

Hey @brandongregoryscott , I also thought of a similar solution to this issue but I seem to fail to build the package. Did you face any similar issues? I am very new to open source contribution and could not find any FAQ of sorts to check if it is an existing issue. Could you guide me or point out some existing resources if any? Thanks in advance.

brandongregoryscott commented 2 years ago

@rutvij2811 Please open up a new issue if you're having trouble running the project. Any output from the build, and version numbers of the tools in your environment would help. Thanks!