CSR-1012 - Uncommented code that is for selecting the first item when clicking outside of box

This commit is contained in:
Leah Schumann 2023-02-08 09:19:20 -05:00
parent d065181758
commit 5100e5ec5b

View file

@ -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");