From 3c91dd52a0f9766beca053b92016296e2f90dc76 Mon Sep 17 00:00:00 2001 From: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com> Date: Fri, 10 May 2024 19:24:23 +0530 Subject: [PATCH] fix: other option not working in multiSelect multi question (#2607) --- .../src/components/questions/MultipleChoiceMultiQuestion.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/surveys/src/components/questions/MultipleChoiceMultiQuestion.tsx b/packages/surveys/src/components/questions/MultipleChoiceMultiQuestion.tsx index 38a4491838..4f93b5b751 100644 --- a/packages/surveys/src/components/questions/MultipleChoiceMultiQuestion.tsx +++ b/packages/surveys/src/components/questions/MultipleChoiceMultiQuestion.tsx @@ -227,10 +227,9 @@ export const MultipleChoiceMultiQuestion = ({ value={getLocalizedValue(otherOption.label, languageCode)} className="border-brand text-brand h-4 w-4 border focus:ring-0 focus:ring-offset-0" aria-labelledby={`${otherOption.id}-label`} - onChange={(e) => { + onChange={() => { setOtherSelected(!otherSelected); - if ((e.target as HTMLInputElement)?.checked) { - if (!otherValue) return; + if (!value.includes(otherValue)) { addItem(otherValue); } else { removeItem(otherValue);