Skip to content

Commit

Permalink
Merge branch 'dev' into USAGOV-2133-readme-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
whitealbum authored Dec 26, 2024
2 parents 7921e2b + 6c44375 commit 45ace41
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile-cms
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ RUN COMPOSER_MEMORY_LIMIT=-1 composer install --ignore-platform-reqs --no-intera

# USER www-data
###############################################################
FROM node:20.10-bullseye-slim AS theme-builder
FROM node:20-bullseye-slim AS theme-builder

ARG BUID=1000
ARG BGID=1000
Expand Down
4 changes: 3 additions & 1 deletion web/themes/custom/usagov/scripts/ceoResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,12 @@ function resubmitForm() {

var inputStreet = localStorage.getItem("uspsStreetAddress");
var inputCity = localStorage.getItem("uspsCity");
var inputState = localStorage.getItem("uspsState");
var inputZip = localStorage.getItem("uspsZipCode");

searchParams.set('input-street', inputStreet);
searchParams.set('input-city', inputCity);
searchParams.set('input-state', inputState);
searchParams.set('input-zip', inputZip);

window.location.search = searchParams.toString();
Expand All @@ -488,7 +490,7 @@ function load() {

let inputStreet = searchParams.get('input-street');
let inputCity = searchParams.get('input-city');
let inputState = searchParams.get('select-dropdown');
let inputState = searchParams.get('input-state');

let inputZip = searchParams.get('input-zip');
let normalizedAddress = inputStreet + ", " + inputCity + ", " + inputState + " " + inputZip;
Expand Down
6 changes: 5 additions & 1 deletion web/themes/custom/usagov/scripts/ceoSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ function uspsResponseParser(responseText, userStreetAddress, userCity, userZipCo
let uspsStreetAddress = responseText.slice(responseText.indexOf('<Address2>') + 10, responseText.indexOf('</Address2>'));
let uspsZipCode = responseText.slice(responseText.indexOf('<Zip5>') + 6, responseText.indexOf('</Zip5>'));
let uspsCity = responseText.slice(responseText.indexOf('<City>') + 6, responseText.indexOf('</City>'));
let uspsState = responseText.slice(responseText.indexOf('<State>') + 7, responseText.indexOf('</State>'));

// Checks if the address suggested by the USPS API is different from the user's address.
// If it's different, it returns the USPS address in the response
Expand All @@ -199,6 +200,7 @@ function uspsResponseParser(responseText, userStreetAddress, userCity, userZipCo

response.streetAddress = uspsStreetAddress;
response.city = uspsCity;
response.state = uspsState;
response.zipCode = uspsZipCode;
}
}
Expand Down Expand Up @@ -360,12 +362,14 @@ async function handleFormSubmission() {
// Stores the suggested address for the address suggestion alert box.
localStorage.setItem("uspsStreetAddress", response.streetAddress);
localStorage.setItem("uspsCity", response.city);
localStorage.setItem("uspsState", response.state);
localStorage.setItem("uspsZipCode", response.zipCode);
localStorage.setItem("formResubmitted", false);
}
else {
localStorage.removeItem("uspsStreetAddress");
localStorage.removeItem("uspsCity");
localStorage.removeItem("uspsState");
localStorage.removeItem("uspsZipCode");
localStorage.removeItem("formResubmitted");
}
Expand Down Expand Up @@ -393,7 +397,7 @@ window.addEventListener("load", function () {
let isChromeOrEdge = navigator.userAgent.includes("Chrome");
// Change attributes so that autofill works in state input
if (isChromeOrEdge) {
let stateSelectBox = document.getElementsByName("select-dropdown")[0];
let stateSelectBox = document.getElementsByName("input-state")[0];
stateSelectBox.setAttribute("autocomplete","country");

let stateInputBox = document.getElementById("input-state");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<select
aria-describedby="state"
class="usa-select"
name="select-dropdown"
name="input-state"
id="input-state"
autocomplete="off"
required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<select
aria-describedby="state"
class="usa-select"
name="select-dropdown"
name="input-state"
id="input-state"
required
autocomplete="off"
Expand Down

0 comments on commit 45ace41

Please sign in to comment.