diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue
index bd1977ba3..006718bed 100644
--- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue
+++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue
@@ -2,8 +2,12 @@
@@ -77,27 +84,47 @@ export default {
checkValue: Boolean,
};
},
- created(){
- if(Array.isArray(this.selectedValues)){
- this.checkValue = this.isMultiSelect ? this.selectedValues.includes(this.value) : this.selectedValues[0];
+ created() {
+ if (Array.isArray(this.selectedValues)) {
+ this.checkValue = this.isMultiSelect
+ ? this.selectedValues.includes(this.value)
+ : this.selectedValues[0];
}
},
methods: {
displayLoader() {
this.isLoaderDisplayed = true;
},
- handleClick(value) {
- if(this.selectingInitiatesLoad) {
- this.displayLoader();
+ handleInputChange() {
+ if(!this.selectingInitiatesLoad) {
+ this.handleCheckChange();
+ }
+ },
+ handleKeyupArrow() {
+ if (this.isMultiSelect) {
+ return; // Prevent arrow keys from doing anything if element is a checkbox
+ }
+
+ if(!this.selectingInitiatesLoad) {
this.handleCheckChange();
}
- this.handleChange(value);
+ this.handleChange(this.value);
},
- handleCheckChange(newValue, oldValue){
- const isInitialization = typeof(oldValue) === 'function';
- if (!isInitialization) {
- this.$emit('isCheckedChanged', { checkValue: this.checkValue, value: this.value.toString() });
+ triggerButton() {
+ if(this.selectingInitiatesLoad) {
+ this.displayLoader();
+ this.handleCheckChange();
}
+ this.handleChange(this.value);
+ },
+ handleCheckChange() {
+ const emitEvent = {
+ checkValue: this.checkValue, // only read on checkboxes, on handleCheckedChanged on button-question
+ value: this.value.toString(),
+ buttonId: this.buttonID && this.buttonID.toString(),
+ };
+ this.$emit("isCheckedChanged", emitEvent);
+ this.$emit("update:modelValue", emitEvent);
}
},
components: {
@@ -105,6 +132,7 @@ export default {
},
setup(props) {
const inputType = props.isMultiSelect ? "checkbox" : "radio";
+
const fieldOptions = {
type: inputType,
checkedValue: props.value,
@@ -118,13 +146,11 @@ export default {
}
const {
- checked,
handleChange,
errors,
} = useField(props.groupName, props.validationRules, fieldOptions);
return {
- checked,
handleChange,
errors,
fieldOptions, // only need to expose this for unit test purposes
diff --git a/src/ux-components/list-button/list-button.vue b/src/ux-components/list-button/list-button.vue
index d48b2407d..300bf6baa 100644
--- a/src/ux-components/list-button/list-button.vue
+++ b/src/ux-components/list-button/list-button.vue
@@ -2,8 +2,12 @@