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: clear input field on blur if the user has not selected any option #3208

Conversation

FredrikMWold
Copy link
Contributor

No description provided.

@FredrikMWold FredrikMWold force-pushed the feat/clear-autocomplete-input-on-blur branch from 42455fc to c4f1442 Compare January 5, 2024 23:19
@oddvernes
Copy link
Collaborator

oddvernes commented Jan 12, 2024

Hello and sorry for the late reply! You are on the right track here but you are using onBlur on the element instead of downshift's stateReducer which is more proper here I think. Then it would be

case useCombobox.stateChangeTypes.InputBlur:
            return {
              ...changes,
              inputValue: changes.selectedItem
                ? getLabel(changes.selectedItem)
                : '',
            }

However while testing this I came across some pre-existing bugs that needed to be fixed at the same time, plus we also needed to add a new "no options" ui-element (see original issue #3070) requiring some designer input, so I decided to handle this task myself. I will however use your test though!

@oddvernes oddvernes closed this Jan 12, 2024
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.

2 participants