Trying to show address when adding text by input when the inputType is autofill

This commit is contained in:
Leah Schumann 2024-05-23 08:48:52 -04:00
parent 6e334c91d3
commit 20dc07ad7d

View file

@ -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.