CSR-762 Simplify multiselect

This commit is contained in:
Katie 2022-09-27 16:30:00 -04:00
parent fff1aa1848
commit e8b751c1b7

View file

@ -81,13 +81,13 @@ export default {
if (this.isMultiSelect) { if (this.isMultiSelect) {
switch (eventType) { switch (eventType) {
case eventTypes.KEYPRESS_SUBMIT: case eventTypes.KEYPRESS_SUBMIT:
case eventTypes.CHANGE:
this.handleClick(e); this.handleClick(e);
break; break;
case eventTypes.CHANGE: // this.selectOnKeypress
this.selectOnKeypress // ? this.handleClick(e)
? this.handleClick(e) // : this.handleSelectionChange(e);
: this.handleSelectionChange(e); // break;
break;
} }
} else { } else {
switch (eventType) { switch (eventType) {
@ -143,8 +143,10 @@ export default {
valueToLogType: this.valueToLogType, valueToLogType: this.valueToLogType,
}); });
window.firedGaClickEventValues = window.firedGaClickEventValues ?? {} window.firedGaClickEventValues =
window.firedGaClickEventValues[window.lastFocusedInputGroup] = value ?? this.value window.firedGaClickEventValues ?? {};
window.firedGaClickEventValues[window.lastFocusedInputGroup] =
value ?? this.value;
this.pushEventToGA( this.pushEventToGA(
this.$route.query[queryStrings.FMG_PAGE], this.$route.query[queryStrings.FMG_PAGE],
this.GaActions.CLICKED, this.GaActions.CLICKED,
@ -155,29 +157,34 @@ export default {
}, },
handleBlur() { handleBlur() {
window.lastFocusedInputGroup = this.groupName; window.lastFocusedInputGroup = this.groupName;
window.wasLastFocusedInputMultiselect = this.isMultiSelect window.wasLastFocusedInputMultiselect = this.isMultiSelect;
}, },
handleFocus() { handleFocus() {
console.log("FOCUS: ", { console.log("FOCUS: ", {
currentlySelectedValues: window.currentlySelectedValues, currentlySelectedValues: window.currentlySelectedValues,
firedGaClickEventValues: window.firedGaClickEventValues, firedGaClickEventValues: window.firedGaClickEventValues,
lastFocusedInputGroup: window.lastFocusedInputGroup, lastFocusedInputGroup: window.lastFocusedInputGroup,
wasLastFocusedInputMultiselect: window.wasLastFocusedInputMultiselect, wasLastFocusedInputMultiselect:
groupName: this.groupName window.wasLastFocusedInputMultiselect,
}) groupName: this.groupName,
});
if ( if (
window.currentlySelectedValues && window.currentlySelectedValues &&
window.firedGaClickEventValues && window.firedGaClickEventValues &&
window.lastFocusedInputGroup && window.lastFocusedInputGroup &&
!window.wasLastFocusedInputMultiselect && !window.wasLastFocusedInputMultiselect &&
window.currentlySelectedValues[window.lastFocusedInputGroup] && window.currentlySelectedValues[window.lastFocusedInputGroup] &&
window.lastFocusedInputGroup != this.groupName && window.lastFocusedInputGroup != this.groupName &&
window.firedGaClickEventValues[window.lastFocusedInputGroup] != window.currentlySelectedValues[window.lastFocusedInputGroup] window.firedGaClickEventValues[window.lastFocusedInputGroup] !=
window.currentlySelectedValues[window.lastFocusedInputGroup]
) { ) {
// TODO MAKE SURE THIS IS FIRING THE RIGHT VALUE // TODO MAKE SURE THIS IS FIRING THE RIGHT VALUE
this.pushClickEventToGA(window.currentlySelectedValues[window.lastFocusedInputGroup]) this.pushClickEventToGA(
window.currentlySelectedValues[window.lastFocusedInputGroup]
);
} }
}, },
test() {}
}, },
computed: { computed: {
isChecked() { isChecked() {