If there is a value set for the country form item by default or by the user, and the user switches to another country, the form items are being replaced via AJAX. This is a big UX issue. There are two issues that come with this behavior:

  1. Tabbing from the country form item doesnt work. Doing so results in not having focus in any form item since the one the user tabbed to is gone.
  2. If the user switches to a field of the old form state, he is able to enter data in the next form item which is then replaced once the AJAX callback is done resulting in data loss.

The severity of both issues depend on how long the server roundtrip takes. The longer it takes the worse the UX is.

In my opinion this is a major issue since it cripples UX and it results in data loss.

I have a live site which has a default country set on the address field to reproduce the issue: https://www.joergboner.ch/simple_order/add/90

Comments

Lukas von Blarer created an issue. See original summary.

Lukas von Blarer’s picture

Issue summary: View changes
Lukas von Blarer’s picture

Title: Resolve UX issue with the AJAX callback » Resolve UX issue with the AJAX callback
Issue summary: View changes
bojanz’s picture

Rebuilding the address fields by ajax on country change is the whole point of this module, so I'm unsure what you're suggesting?

Lukas von Blarer’s picture

Sure, but I am pointing out that this results in a UX issue we should try to resolve or at least reduce it's negative effects. For example we could disable all form items during the ajax callback since all data entered will be lost anyway.

bojanz’s picture

Sure, that's a good idea.

Lukas von Blarer’s picture

But that is actually an issue with core. This happens to all forms i think. Do you know about an issue covering this in core? I've heard a lot of people complain about this in different cases. E.g. people new to Drupal ask why there is a server roundtrip necessary to add another value to a multi value field. I know why, but this is just not what people are used to in the age of decoupled web apps.

Should we try to solve this for address temporarily since the UX of the checkout process is very critical?

bojanz’s picture

I don't think we'll have luck changing that in core. Conceptually it's hard to do generically, cause you don't know which fields are going to be replaced. Address always knows which fields it's clearing, so it's much easier to do it in a field type specific way.

Lukas von Blarer’s picture

Makes sense. Let's try this.

LewisNyman’s picture

Maybe it would be easier to store the form data in the browser and then refill the new items once they have been loaded?

Lukas von Blarer’s picture

That would be great... But isn't that a huge amount of data?