diff --git a/frontend/src/app/components/select/SelectField.jsx b/frontend/src/app/components/select/SelectField.jsx index d155bc6..72a99c6 100644 --- a/frontend/src/app/components/select/SelectField.jsx +++ b/frontend/src/app/components/select/SelectField.jsx @@ -15,18 +15,16 @@ const SelectField = ({ label, options, ...props }) => { }); useEffect(() => { - if (showOptions && selectRef.current) { - const rect = selectRef.current.getBoundingClientRect(); - const spaceBelow = window.innerHeight - rect.bottom; - const spaceAbove = rect.top; - const dropdownHeight = 150; + if (!showOptions || !selectRef.current) return; - if (spaceBelow < dropdownHeight && spaceAbove > dropdownHeight) { - setDropUp(true); - } else { - setDropUp(false); - } - } + const rect = selectRef.current.getBoundingClientRect(); + + const spaceBelow = window.innerHeight - rect.bottom; + const spaceAbove = rect.top; + + const dropdownHeight = 150; + + setDropUp(spaceBelow < dropdownHeight && spaceAbove > dropdownHeight); }, [showOptions]); return (