From 8e5804e3c1241167ca15b139d4fb717c47a9f03c Mon Sep 17 00:00:00 2001 From: Favour Ohanekwu Date: Mon, 15 Jul 2024 05:59:33 +0100 Subject: [PATCH] fix: Convert 'select" element to 'input' element (#148) * fix overflowing text * Use convert select element to an input-dropdown * Use 100% width for dropdown options * revert changelog changes --- .../components/inputField/InputDropdown.tsx | 50 ++++++++++++++----- src/ui/components/inputField/InputField.css | 23 +++++++++ .../components/userDetail/userDetailForm.scss | 3 ++ 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/src/ui/components/inputField/InputDropdown.tsx b/src/ui/components/inputField/InputDropdown.tsx index 05a9ba6c..c2b7d010 100644 --- a/src/ui/components/inputField/InputDropdown.tsx +++ b/src/ui/components/inputField/InputDropdown.tsx @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -import React, { useCallback, useState } from "react"; +import React, { useCallback, useRef, useState } from "react"; import { getImageUrl } from "../../../utils"; import TooltipContainer from "../tooltip/tooltip"; @@ -48,6 +48,8 @@ const InputDropdown: React.FC = (props) => { const [isFocused, setIsFocused] = useState(false); const [isTouched, setIsTouched] = useState(false); + const inputRef = useRef(null); + const onChange = useCallback( ( event: @@ -64,7 +66,13 @@ const InputDropdown: React.FC = (props) => { const showError = props.error && (isTouched || props.forceShowError); return ( -
+
{ + setTimeout(() => { + setIsFocused(false); + }, 100); + }}> {props.label && (
)} - -
+ + )} {showError && errorPlacement === "bottom" && (