furious-luke / django-address

A Django address model and field. Addresses may be specified by address components or by performing an automatic Google Maps lookup.
BSD 3-Clause "New" or "Revised" License
431 stars 181 forks source link

Geocoded auto-suggest data can be lost by clicking on page #118

Open banagale opened 4 years ago

banagale commented 4 years ago

As originally described here.

It appears possible to have the .change() jquery event detect a click on the page that will end up clearing meta used during form submission.

Reproduction Steps

This is a whole extra ask, but would you mind trying to repro this bug?

If you don't have time, totally okay--I'll accept this regardless. But if you can also see this happening, it would be good to get some confirmation and it may be something that could affect your project. Regardless I'll also file an issue to either validate this and / or fix this.

Here's an archive with two screen recordings that show the behavior: Archive.zip

You can see it clearly in onchangebug.mp4 at 33 seconds when I click away from the geocoded Foothills address.

The jquery-bug-small.mp4 shows how when this occurs, the locality data does not make it beyond the raw.

I suspect this must be some light async issue that can be resolved in a line or two but I haven't looked at it closely.

banagale commented 4 years ago

I was able to regularly reproduce this in chrome 83.0.4103.106

It only happens when you type in a partial address, tap the down arrow key to select the top most result, hit enter, then click on the page instead of the submit button. The geocoded data is lost.

This does not happen if you use the mouse to select the auto complete result. I believe the fix needed is in address.js use of the .change event here.