instedd / cdx

Connected Diagnostics Platform
https://cdx.io
9 stars 7 forks source link

The UX for the new batch/samples field is odd #1964

Closed diegoliberman closed 1 year ago

diegoliberman commented 1 year ago

If you enter values "fastly" for the 4 fields, you get with a weird ux:

  1. not found message even when the focus has already left the field long ago
  2. loading icons in the 4 fields if you go fast enough (I guess this is ok).
  3. not found message for all fields

I think we should show the not found message only if the user is still with the focus in the field.

image image

leandroradusky commented 1 year ago

After some testing, this is happening when the tab is pressed before the loading of values is finished. For the clicking, the click in other places prevented, then, the best solution that I found for this is to do the same, to add :

if (this.isLoading()) {
  event.preventDefault();
}

In the tab key handling for react-select. This, when the tab key is pressed will "wait" until the loading of possible values is finished to allow "tabing" to the next field.

Do we agree with this solution or do you think something better can/should be done?

cc @ysbaddaden @diegoliberman

diegoliberman commented 1 year ago

I would need to see it in action. Maybe you can show me in local?

ysbaddaden commented 1 year ago

We paired on this issue and found a way to replicate the issue easily by adding a sleep to the request. We got solutions to fix the glitch.

sardar-usman commented 1 year ago

@leandroradusky It looks good now. When the query searching for the data is canceled, the component stops doing it, working as expected.