onBlur behaviour is affected by "touch capabilities"
See original GitHub issueAre you reporting a bug or runtime error?
That’s not really a bug, and not an error - this is a not correct behavior.
There is an option - blurInputOnSelect
blurInputOnSelect: isTouchCapable(),
and the effect of it quite simple:
selectOption = (newValue: OptionType) => {
....
if (blurInputOnSelect) {
this.blurInput();
}
Problems
-
Should it be delayed? In normal conditions there are two different events (click/change, blur) comes one after another with a little “gap” between them. But in this case - there is no gap. This results into some differences in the “state management” -
blur
evens is reported too soon - before thechange
(or select) event is finishing propagation (state change applied back to the component). ProbablyonBlur
should be called insetTimeout
, or at least aPromise
-
Should it even exists?
For all “touch devices”, windows 10 on hybrid devices included, or only when select is caused by “touch” event? Probably here we should checktouch event
, and executeblur
only there, but not as a part ofselectOption
-
Is it a real problem? Yes, it is. We run into it twice this year, causing SEV1s both times.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:7
Top GitHub Comments
Yup, though we’re using
setTimeout(f, 0)
instead ofsetImmediate(f)
.I believe we are having issues stemming from this as well, on touch devices the
onBlur
triggers beforeonChange
, sometimes, which prevents the change event entirely.