Lundalogik / lime-elements

Provides reusable web components for Lime CRM
https://lundalogik.github.io/lime-elements/versions/latest
Other
38 stars 11 forks source link

Field loses focus when validation is performed #1348

Closed mjlime closed 3 years ago

mjlime commented 3 years ago

Current behavior

field-loose-focus-after-validation

Steps to reproduce the behavior:

  1. Create a schema with a required decimal field.
  2. Start with the field empty.
  3. Put focus on the field and start typing 1 digit.
  4. The field now loses focus when the validation is performed and the error is removed.

Expected behavior

The focus should still be on the field with the cursor at the same place so I can continue typing seamlessly.

Environment

adrianschmidt commented 3 years ago

This is reproducible in the docs for v33.11.0 too. I'd say this is a pretty serious bug.

Thanks for the report!

jensgustafsson commented 3 years ago

I could reproduce this with lime-elements v32 as well in the webclient.

adrianschmidt commented 3 years ago

I could reproduce this with lime-elements v32 as well in the webclient.

I've tested a little, and yes, the bug is similar, but not identical in v32.4.4 and the latest version. In v32.4.4, the focus is only lost when the field changes from valid to invalid, whereas in v33.12.0, focus is lost when the validity of the field changes, regardless of whether it's valid → invalid or invalid → valid.

I did previously think that the focus problem also applied to non-numeric fields in v33+, but that doesn't seem to be the case. I'm not sure if something's changed, or if I was just confused to begin with 😅

However, the numeric input field in v32.4.4, when configured to format the input, shows the formatted input all the time, instead of showing the actual input when the field is focused. This creates a lag in the input, and other annoying bugs. So, while I think we want to fix the focus bug, because it's really annoying, I don't think it has to stop us from releasing v33+, even if we haven't fixed the bug yet.

@jensgustafsson

jensgustafsson commented 3 years ago

Ping @blombergedvin

Some nice news :)

lime-ci commented 3 years ago

:tada: This issue has been resolved in version 33.12.1-next.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

lime-ci commented 3 years ago

:tada: This issue has been resolved in version 33.13.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: