Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump prettier from 3.2.4 to 3.2.5 #656

Merged
merged 4 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore minified files
**/*.min.js

# Ignore all non-lintable files:
**/*.html
**/*.md
**/*.pdf
**/*.scss
**/*.yml
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ Demo|https://demo.simplereport.gov|Automed on merge to `main`|[Github Actions](#
Test|https://test.simplereport.gov|Automed on merge to `main`|[Github Actions](#manually-trigger-deploy)
Pentest|https://pentest.simplereport.gov|Automed on merge to `main`|[Github Actions](#manually-trigger-deploy)
Training|https://training.simplereport.gov|Automed on merge to `main`|[Github Actions](#manually-trigger-deploy)
github pages|https://cdcgov.github.io/prime-simplereport-site/|Automed on merge to `main` and `gh-pages`|`yarn deploy`
14 changes: 10 additions & 4 deletions assets/js/sr-touchpoints.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// custom touchpoints modifications for improved accessibility
'use strict';
"use strict";

function initCustomTouchpointsJS() {
const TOUCHPOINTS_MODAL_CLASS = ".fba-modal";
const TOUCHPOINTS_BUTTON_ID = "#fba-button";
// NOTE: Will need to update this if there are multiple "Other" options + "Other" text inputs; currently this supports only one
const TOUCHPOINTS_OTHER_INPUT_ID = "#answer_01_other";
const TOUCHPOINTS_OTHER_RADIO_ID = "#answer_01_3";
const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const focusableElements =
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';

// modified from https://uxdesign.cc/how-to-trap-focus-inside-modal-to-make-it-ada-compliant-6a50f9a70700
// traps keyboard focus when tabbing through touchpoints modal
Expand Down Expand Up @@ -56,10 +57,15 @@ function initCustomTouchpointsJS() {
}

function attachModalToggleListener() {
const touchpointsModalButton = document.querySelector(TOUCHPOINTS_BUTTON_ID);
const touchpointsModalButton = document.querySelector(
TOUCHPOINTS_BUTTON_ID,
);
touchpointsModalButton.addEventListener("click", function () {
const modal = document.querySelector(TOUCHPOINTS_MODAL_CLASS);
if (modal !== null && window.getComputedStyle(modal).display === "block") {
if (
modal !== null &&
window.getComputedStyle(modal).display === "block"
) {
attachTabEventListener(modal);
toggleInputDisabledAttr(TOUCHPOINTS_OTHER_INPUT_ID);
attachRadioChangeEventListener();
Expand Down
74 changes: 35 additions & 39 deletions assets/js/touchpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function FBAform(d, N) {
formId: "2a6e9509",
formComponent: function () {
return document.querySelector(
"[data-touchpoints-form-id='" + this.formId + "']"
"[data-touchpoints-form-id='" + this.formId + "']",
);
},
formElement: function () {
Expand All @@ -22,11 +22,10 @@ function FBAform(d, N) {
// enable Javascript experience
javscriptIsEnabled: function () {
var javascriptDisabledMessage = document.getElementsByClassName(
"javascript-disabled-message"
)[0];
var touchpointForm = document.getElementsByClassName(
"touchpoint-form"
"javascript-disabled-message",
)[0];
var touchpointForm =
document.getElementsByClassName("touchpoint-form")[0];
if (javascriptDisabledMessage) {
javascriptDisabledMessage.classList.add("hide");
}
Expand Down Expand Up @@ -71,22 +70,22 @@ function FBAform(d, N) {
d.querySelector(".fba-modal-close").addEventListener(
"click",
this.handleDialogClose.bind(this),
false
false,
);
var otherElements = d.querySelectorAll(".usa-input.other-option");
for (var i = 0; i < otherElements.length; i++) {
otherElements[i].addEventListener(
"keyup",
this.handleOtherOption.bind(this),
false
false,
);
}
var phoneElements = d.querySelectorAll("input[type='tel']");
for (var i = 0; i < phoneElements.length; i++) {
phoneElements[i].addEventListener(
"keyup",
this.handlePhoneInput.bind(this),
false
false,
);
}

Expand All @@ -103,7 +102,7 @@ function FBAform(d, N) {
submitButton.addEventListener(
"click",
that.handleYesNoSubmitClick.bind(that),
false
false,
);
});
} else {
Expand All @@ -113,7 +112,7 @@ function FBAform(d, N) {
submitButton.addEventListener(
"click",
that.handleSubmitClick.bind(that),
false
false,
);
});
}
Expand All @@ -122,16 +121,13 @@ function FBAform(d, N) {
resetErrors: function () {
var formComponent = this.formComponent();
var alertElement = formComponent.querySelector(".fba-alert");
var alertElementHeading = formComponent.getElementsByClassName(
"usa-alert__heading"
)[0];
var alertElementBody = formComponent.getElementsByClassName(
"usa-alert__text"
)[0];
var alertElementHeading =
formComponent.getElementsByClassName("usa-alert__heading")[0];
var alertElementBody =
formComponent.getElementsByClassName("usa-alert__text")[0];
var alertErrorElement = formComponent.querySelector(".fba-alert-error");
var alertErrorElementBody = alertErrorElement.getElementsByClassName(
"usa-alert__text"
)[0];
var alertErrorElementBody =
alertErrorElement.getElementsByClassName("usa-alert__text")[0];
alertElement.setAttribute("hidden", true);
alertElementHeading.innerHTML = "";
alertElementBody.innerHTML = "";
Expand Down Expand Up @@ -174,7 +170,8 @@ function FBAform(d, N) {
e.srcElement.value = number;
},
handleEmailInput: function (e) {
var EmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var EmailRegex =
/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var email = e.srcElement.value.trim();
if (email.length == 0) {
return;
Expand Down Expand Up @@ -204,7 +201,7 @@ function FBAform(d, N) {
e.preventDefault();

var input = this.formComponent().querySelector(
".fba-touchpoints-page-form"
".fba-touchpoints-page-form",
);
input.value = e.target.value;
this.resetErrors();
Expand Down Expand Up @@ -253,7 +250,7 @@ function FBAform(d, N) {
for (var key in questions) {
this.showValidationError(
questions[key],
"You must respond to question: "
"You must respond to question: ",
);
return false;
}
Expand All @@ -277,7 +274,7 @@ function FBAform(d, N) {
for (var key in questions) {
this.showValidationError(
questions[key],
"Please enter a valid value: "
"Please enter a valid value: ",
);
return false;
}
Expand All @@ -294,14 +291,15 @@ function FBAform(d, N) {
if (item.value.length == 0) {
delete questions[item.name];
} else {
var EmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var EmailRegex =
/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (EmailRegex.test(item.value)) delete questions[item.name];
}
});
for (var key in questions) {
this.showValidationError(
questions[key],
"Please enter a valid value: "
"Please enter a valid value: ",
);
return false;
}
Expand All @@ -325,7 +323,7 @@ function FBAform(d, N) {
for (var key in questions) {
this.showValidationError(
questions[key],
"Please enter a valid value: "
"Please enter a valid value: ",
);
return false;
}
Expand Down Expand Up @@ -397,7 +395,7 @@ function FBAform(d, N) {
this.buttonEl.addEventListener(
"click",
this.handleButtonClick.bind(this),
false
false,
);
this.buttonEl.innerHTML = this.options.modalButtonText;
d.getElementsByTagName("footer")[0].appendChild(this.buttonEl);
Expand Down Expand Up @@ -447,7 +445,7 @@ function FBAform(d, N) {
var formElement = this.formElement();
var alertElement = formComponent.querySelector(".fba-alert");
var alertElementHeading = formComponent.querySelector(
".usa-alert__heading"
".usa-alert__heading",
);
var alertElementBody = formComponent.querySelector(".usa-alert__text");

Expand All @@ -468,7 +466,7 @@ function FBAform(d, N) {
}
if (formComponent.querySelector(".touchpoints-form-disclaimer")) {
var formDisclaimer = formComponent.querySelector(
".touchpoints-form-disclaimer"
".touchpoints-form-disclaimer",
);
if (formDisclaimer) {
formDisclaimer.setAttribute("hidden", true);
Expand Down Expand Up @@ -503,13 +501,11 @@ function FBAform(d, N) {
// Clear the alert box
var formComponent = this.formComponent();
var alertElement = formComponent.querySelector(".fba-alert");
var alertElementBody = formComponent.getElementsByClassName(
"usa-alert__text"
)[0];
var alertElementBody =
formComponent.getElementsByClassName("usa-alert__text")[0];
var alertErrorElement = formComponent.querySelector(".fba-alert-error");
var alertErrorElementBody = alertErrorElement.getElementsByClassName(
"usa-alert__text"
)[0];
var alertErrorElementBody =
alertErrorElement.getElementsByClassName("usa-alert__text")[0];
alertElementBody.innerHTML = "";
alertErrorElementBody.innerHTML = "";

Expand Down Expand Up @@ -575,7 +571,7 @@ function FBAform(d, N) {
form.querySelector("input[name=answer_06]:checked") &&
Array.apply(
null,
form.querySelectorAll("input[name=answer_06]:checked")
form.querySelectorAll("input[name=answer_06]:checked"),
)
.map(function (x) {
return x.value;
Expand Down Expand Up @@ -604,7 +600,7 @@ function FBAform(d, N) {
xhr.send(
JSON.stringify({
submission: params,
})
}),
);
},
pagination: function () {
Expand All @@ -622,7 +618,7 @@ function FBAform(d, N) {
currentPage.classList.remove("visible");
currentPage.previousElementSibling.classList.add("visible");
window.scrollTo(0, 0);
}.bind(self)
}.bind(self),
);
}

Expand All @@ -636,7 +632,7 @@ function FBAform(d, N) {
currentPage.classList.remove("visible");
currentPage.nextElementSibling.classList.add("visible");
window.scrollTo(0, 0);
}.bind(self)
}.bind(self),
);
}
},
Expand Down
Loading
Loading