Merge pull request #1861 from Safelite/feature/CSR-2065

Testing again
This commit is contained in:
Leah Schumann 2024-05-22 11:06:51 -04:00 committed by GitHub
commit 47a6c9f963
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -293,11 +293,13 @@ export default {
case "insertText": case "insertText":
case "insertFromPaste": case "insertFromPaste":
case "deleteContentBackward": 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(); this.disableAutoFill();
break; break;
default: default:
// If the user enters text by *autofill* then disable the *autocomplete* // If the user enters text by *autofill* then disable the *autocomplete*
this.showAddressFields = true;
//this.addressField1.dispatchEvent(new Event("change"))
this.unloadAutocomplete(); this.unloadAutocomplete();
} }
}); });
@ -444,22 +446,24 @@ export default {
this.loadGooglePlacesAutocompleteScript(); this.loadGooglePlacesAutocompleteScript();
} }
const element = document.getElementsByClassName("address-questions")[0]; // Temporary
element.addEventListener("change", (e) => { // const element = document.getElementsByClassName("address-questions")[0];
if (this.showAddressFields) { // element.addEventListener("change", (e) => {
return false; // console.log(e)
} // if (this.showAddressFields) {
// return false;
// }
let autoFilledInputs = []; // let autoFilledInputs = [];
autoFilledInputs = element.querySelectorAll("input:-webkit-autofill"); // autoFilledInputs = element.querySelectorAll("input:-webkit-autofill");
this.showAddressFields = autoFilledInputs.length > 0; // this.showAddressFields = autoFilledInputs.length > 0;
if (this.showAddressFields) { // if (this.showAddressFields) {
this.unloadAutocomplete(); // this.unloadAutocomplete();
} // }
this.addressField1.classList.remove("has-icon"); // this.addressField1.classList.remove("has-icon");
}); // });
}, },
beforeUpdate() { beforeUpdate() {
// It is necessary to set focus on the street address on this lifecycle hook when this component is used in a modal. // It is necessary to set focus on the street address on this lifecycle hook when this component is used in a modal.