From 20dc07ad7df92f9c2ee28b74212d145818b14276 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Thu, 23 May 2024 08:48:52 -0400 Subject: [PATCH] Trying to show address when adding text by input when the inputType is autofill --- .../address-questions/address-questions.vue | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/src/fmg-components/address-questions/address-questions.vue b/src/fmg-components/address-questions/address-questions.vue index 77fabeebf..7be0eed23 100644 --- a/src/fmg-components/address-questions/address-questions.vue +++ b/src/fmg-components/address-questions/address-questions.vue @@ -299,12 +299,13 @@ export default { case "insertText": case "insertFromPaste": case "deleteContentBackward": - // If the user enters text by typing, or pasting text, or deleting text already entered, disable *autofill* + // If the user enters text by typing, or pasting text, or deleting text already entered, disable *autofill* this.disableAutoFill(); break; default: // If the user enters text by *autofill* then disable the *autocomplete* - //this.showAddressFields = true; + this.showAddressFields = true; + this.addressField1.classList.remove("has-icon"); //this.addressField1.dispatchEvent(new Event("change")) this.unloadAutocomplete(); } @@ -454,37 +455,37 @@ export default { } // Temporary - const element = document.getElementsByClassName("address-questions")[0]; - element.addEventListener( - "change", - (e) => { - // console.log(`change event`); - // console.log(e); + // const element = document.getElementsByClassName("address-questions")[0]; + // element.addEventListener( + // "change", + // (e) => { + // // console.log(`change event`); + // // console.log(e); - if (this.showAddressFields) { - return false; - } + // if (this.showAddressFields) { + // return false; + // } - let autoFilledInputs = []; - autoFilledInputs = element.querySelectorAll("input:-webkit-autofill"); + // let autoFilledInputs = []; + // autoFilledInputs = element.querySelectorAll("input:-webkit-autofill"); - console.log(this.addressModel.city); - this.$nextTick(() => { - this.showAddressFields = autoFilledInputs.length > 0; - console.log(this.addressModel.city); - console.log(document.getElementById("city").value); - }); - console.log(this.addressModel.city); - console.log(document.getElementById("city").value); + // console.log(this.addressModel.city); + // this.$nextTick(() => { + // this.showAddressFields = autoFilledInputs.length > 0; + // console.log(this.addressModel.city); + // console.log(document.getElementById("city").value); + // }); + // console.log(this.addressModel.city); + // console.log(document.getElementById("city").value); - if (this.showAddressFields) { - this.unloadAutocomplete(); - } + // if (this.showAddressFields) { + // this.unloadAutocomplete(); + // } - this.addressField1.classList.remove("has-icon"); - } - // { once: true } - ); + // this.addressField1.classList.remove("has-icon"); + // } + // // { once: true } + // ); }, beforeUpdate() { // It is necessary to set focus on the street address on this lifecycle hook when this component is used in a modal.