-
Notifications
You must be signed in to change notification settings - Fork 330
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
Unfocusing input element reverts value to typed contents (urgent) #241
Comments
I don't seem to be able to replicate the problem you have, could you edit the sandbox to show what's going on? https://codesandbox.io/s/5w1wq126pn |
Per your sample there - all you have to do is add I am using the selected contents to generate tags elsewhere on the page, so I'd like to wipe the autocomplete input... however it does not seem to work and refills when defocusing the element. |
Okay, I can replicate it now, one thing that already can be done is changing not to include a https://github.com/algolia/autocomplete.js/blob/f0822304e8c0f6ee90ed4db78b0140ac451c3e46/src/autocomplete/input.js#L93-L97 is called, it sets the value back to the query on blur. I think it would make sense for your use case to add an option to reset that to empty query instead of the query. Are you interested in contributing that? |
Too busy to do so sadly, working on business logic for the foreseeable future... Is this something that could be done in house? the use case is general enough, although users would have to roll their own tagging mechanism (which is what we've done). |
Thanks @Haroenv - curious how it will be implemented, will there be a new option, will it automagically detect input value being wiped? Just want to prep my code for the patch :) |
I'd add it as a new option @alystair |
In some use-cases, like when you're using autocomplete to make tags on a page, or using the output in any other way than prefilling the query, you don't want the suggested value to show in the input, but would rather like it to be empty. Before this PR it was basically impossible to have your input not filled, since it came back on blur and a few different places (see `resetInputValue` fixes #241
…ing (#244) * feat(clearOnSelected): allow users to clear the input instead of filling In some use-cases, like when you're using autocomplete to make tags on a page, or using the output in any other way than prefilling the query, you don't want the suggested value to show in the input, but would rather like it to be empty. Before this PR it was basically impossible to have your input not filled, since it came back on blur and a few different places (see `resetInputValue` fixes #241 * fix: make sure both query and input are '' * chore: update test * chore: test implem of callback too * chore: more specific test
@alystair this is now released on the CDN at version 0.31.0 |
BUG
What is the current behavior?
When deselecting form field, contents revert to what was typed, not autocomplete. See animated sample:
Settings are: hint:false, openOnFocus:true, autoselectOnBlur:true
What is the expected behavior?
Deselecting the field should not revert contents to what was typed... although it would make sense to replace value if you click on the field again to edit choice.
The text was updated successfully, but these errors were encountered: