Vaadin form & binder: odd behavior when choosing a value from a prefill list

Viewed 28

I am having an odd/buggy behavior with a form where I can't say whether the bug is with Vaadin's binder or the browser (Brave/Chrome) or what's going on here:

The form provides a couple of entry fields (some numeric values, a few email addresses and some text fields). When I click into one of the email fields my browsers opens a selection box and offers a couple of saved email addresses as "auto-fill" values.

If I select one of these (or actually already, when I just hover with the mouse over one of those "auto-fill" choices) ALL fields of that form are being populated with that value, i.e. not just the email field that currently contains the cursor but ALL fields, also the numeric fields are populated with that value. This immediately causes those fields to show "wiggles" as the input data is of course illegal.

If I didn't click but just hovered over that selection and move the cursor away again from that auto-fill selection then the previous values are restored again.

If I ignore that autofill-selection and just start typing my value then the field works as one would expect. So, it's not a blocking issue but this effect, that just by hovering over a value suddenly fills ALL fields with that value, is VERY irritating.

Any idea anyone, what might be going on here and how one can prevent that? I would expect that only the field that has the cursor focus is touched here.

1 Answers

While what you describe sounds a little weird, I suspect it's related to a browser feature that is usually named "autofill" or "autocomplete". Vaadin components such as TextField have a setAutocomplete method that you can use to give the browser hints about how you want to treat the field. To disable it, you can use field.setAutocomplete(Autocomplete.OFF) even though there might be some circumstances when the browser doesn't respect the hint.

Related