tiagobento commented on code in PR #2350:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2350#discussion_r1608867341


##########
packages/boxed-expression-component/src/expressions/ExpressionDefinitionRoot/ExpressionDefinitionLogicTypeSelector.tsx:
##########
@@ -454,6 +459,28 @@ export function ExpressionDefinitionLogicTypeSelector({
     setVisibleHelp((previousHelp) => (previousHelp !== help ? help : ""));
   }, []);
 
+  useLayoutEffect(() => {
+    if (selectLogicTypeContainer.current) {
+      const boundingClientRect = 
selectLogicTypeContainer.current?.getBoundingClientRect();
+      if (boundingClientRect) {
+        const yPos = boundingClientRect.top;
+        const availableHeight = document.documentElement.clientHeight;
+        if (DEFAULT_LOGIC_TYPE_SELECTOR_HEIGHT + yPos > availableHeight) {
+          const offset = DEFAULT_LOGIC_TYPE_SELECTOR_HEIGHT + yPos - 
availableHeight;
+          selectLogicTypeContainer.current.style.height =
+            DEFAULT_LOGIC_TYPE_SELECTOR_HEIGHT - offset - 
LOGIC_TYPE_SELECTOR_BOTTOM_MARGIN + "px";
+          selectLogicTypeContainer.current.style.overflowY = "scroll";
+        } else {
+          selectLogicTypeContainer.current.style.height = 
DEFAULT_LOGIC_TYPE_SELECTOR_HEIGHT + "px";
+          selectLogicTypeContainer.current.style.overflowY = "visible";
+        }
+      } else {
+        selectLogicTypeContainer.current.style.height = 
DEFAULT_LOGIC_TYPE_SELECTOR_HEIGHT + "px";
+        selectLogicTypeContainer.current.style.overflowY = "visible";
+      }
+    }
+  });

Review Comment:
   Please don't forget to put the dependencies here, otherwise this will 
execute every time this component re-renders.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to