From b5cf4e9bcefdffe24bd0e3e6ea94b86e79bb57b2 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 24 Jun 2024 10:51:05 -0400 Subject: [PATCH] Moved the code that appends the google autocomplete dropdown to the first keydown event --- src/fmg-components/address-questions/address-questions.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fmg-components/address-questions/address-questions.vue b/src/fmg-components/address-questions/address-questions.vue index dfbbb7c52..66ce8e1e6 100644 --- a/src/fmg-components/address-questions/address-questions.vue +++ b/src/fmg-components/address-questions/address-questions.vue @@ -243,11 +243,11 @@ export default { this.fillInAddress ); - // When the Street Address textbox receives focus, + // When the Street Address textbox receives input for the first time, // append the search results list container to the bottom of the textbox // and disable browser autofill this.addressField1.addEventListener( - "focus", + "keydown", (e) => { // Make place results box stick to the input on scroll const streetAddressField = document.getElementById("streetAddressField"); @@ -276,6 +276,7 @@ export default { const addressFields = document.querySelectorAll( ".address-questions input, .address-questions select" ); + for (let addressField of addressFields) { addressField.addEventListener("input", (e) => { switch (e.inputType) { @@ -433,6 +434,7 @@ export default { (this.addressModel.zipCode ?? "") !== ""; if (!this.showAddressFields) { + console.log("loading autocomplete"); this.loadGooglePlacesAutocompleteScript(); } },