Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Autocomplete onChange does not fire when backspace-deleting last character #56

Open
dminkovsky opened this issue May 23, 2017 · 2 comments

Comments

@dminkovsky
Copy link

dminkovsky commented May 23, 2017

I don't have code to replicate but it's easy on the demo page:

  1. In the autocomplete example, type "a"
  2. "Afghanistan" with be the full value; "A" will not be selected; "fghanistan" will be selected; the cursor is between "A" and "fghanistan" (selectionStart=1, selectionEnd=${"Afghanistan".length}).
  3. Press backspace
  4. Observe "onChange" is not fired.

"onChange" is fired for all other cases that I expect it to be fired. Just not this one.

I am trying to figure out why this happens. I think I've gotten a decent grasp on how Autocomplete.jsx works, but I have not figured out what is canceling or preventing this event.

Any help or insights would be appreciated. Thank you!

@whirmill
Copy link

whirmill commented Aug 10, 2017

👍

It seems that clearing the first character with backspace doesn't trigger the handleChange method but when the text is selected entirely and backspace is pressed the method gets called.

@whirmill
Copy link

whirmill commented Aug 10, 2017

I've made a pull request to fix this issue:

#59

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants