onChange not called when selectedItem is already set to the inputs value
See original GitHub issuedownshift
version: 1.13node
version: codesandboxnpm
(oryarn
) version: codesandbox
Problem description:
Go to the typeahead example
- Type “orange”
- Wait for the selection list to appear.
- Select “orange”
The alert “You selected orange” does not appear, because onChange
is not triggered.
Probably caused by: https://github.com/paypal/downshift/blob/master/src/downshift.js#L283
Suggested solution:
Would anything speak against calling onChange
even if the value did not change, as long as selectedItem
is part of stateToSet
? Or maybe allow by flag?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Why am I not getting the value from onChange with Select?
To obtain the value of the selected option, you need to get the selected option from the options by selectedIndex and then get...
Read more >useCombobox - Downshift
It returns a set of props that are meant to be called and their results destructured on the ... selectedItem, State value with...
Read more >react input onchange doesn't work - You.com | The AI Search ...
When attaching Inputmask to event inside of react component there is no way to know when value has been changed. React uses input...
Read more >SCR19: Using an onchange event on a select element ... - W3C
Navigate to the trigger select element, navigate through the options but do not change the value. Check that the matching option values are...
Read more >Select - Ant Design
virtual, Disable virtual scroll when set to false, boolean ; onBlur, Called when blur, function ; onChange, Called when select an option or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep, after considering it, I’ll merge any PR that implements this in a way that’s as simple as possible, is tested, and documented 👍
Hmmm… So I’m thinking that maybe adding an
onSelect
may not be a terribly bad idea. This behavior (the current behavior) makes sense to me:type apple -> select apple ->
onChange
andonSelect
called press arrow down -> select apple ->onChange
not called,onSelect
calledI think that’s what you suggested in the first place. Is that right?