diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index a3e49369c..9ed26f29d 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -277,6 +277,24 @@ export default { } }); + addressField1.addEventListener("change", () => { + // If a match has been previously attempted then do nothing + if (self.matchFound !== null) { + return; + } + + // Get the address that the user clicked on (if any) + const clickedAddress = document.querySelector( + ".pac-container .pac-item:hover" + ); + + // If the Street Address field changed without clicking (i.e. by pressing Tab, or clicking outside the field) + if (clickedAddress === null) { + // Fill-in the address using first item in the list. + fillInAddressUsingFirstItem(); + } + }); + function fillInAddressUsingFirstItem() { // Fill-in the address using first item in the list. const item = document.querySelector(".pac-container .pac-item");