From ed33ea95e7befd93beb02c192f3adf2e5cd26692 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Fri, 28 Jun 2024 17:56:15 +0300
Subject: [PATCH] fix on enter

---
 .../NumericalAnswerDropDownCompontent.js          | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/wax-questions-service/src/NumericalAnswerService/components/NumericalAnswerDropDownCompontent.js b/wax-questions-service/src/NumericalAnswerService/components/NumericalAnswerDropDownCompontent.js
index 9bea5b90c..249bd2e58 100644
--- a/wax-questions-service/src/NumericalAnswerService/components/NumericalAnswerDropDownCompontent.js
+++ b/wax-questions-service/src/NumericalAnswerService/components/NumericalAnswerDropDownCompontent.js
@@ -140,6 +140,7 @@ const NumericalAnswerDropDownCompontent = ({ node }) => {
 
   const onKeyDown = (e, index) => {
     e.preventDefault();
+    updateWaxView();
     // arrow down
     if (e.keyCode === 40) {
       if (index === itemRefs.current.length - 1) {
@@ -191,17 +192,21 @@ const NumericalAnswerDropDownCompontent = ({ node }) => {
   };
 
   const onChange = option => {
+    updateWaxView();
+    context.setOption({ [node.attrs.id]: { numericalAnswer: option.value } });
+    setLabel(option.label);
+    openCloseMenu();
+    SaveTypeToNode(option.value);
+    activeView.focus();
+  };
+
+  const updateWaxView = () => {
     context.updateView(
       {
         main: context.pmViews.main,
       },
       'main',
     );
-    context.setOption({ [node.attrs.id]: { numericalAnswer: option.value } });
-    setLabel(option.label);
-    openCloseMenu();
-    SaveTypeToNode(option.value);
-    activeView.focus();
   };
 
   const NumericalAnswerDropDown = useMemo(
-- 
GitLab