From 68dafa368442963172b221b5a50a2298f1af9ca6 Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Thu, 24 Oct 2024 16:26:22 +0200 Subject: [PATCH] disable clear button if field is readonly --- components/form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/form.js b/components/form.js index 221fe52b..c51e587b 100644 --- a/components/form.js +++ b/components/form.js @@ -526,8 +526,8 @@ function InputInner ({ const [showClearButton, setShowClearButton] = useState(clear) useEffect(() => { - setShowClearButton(clear && field.value) - }, [field.value]) + setShowClearButton(clear && field.value && !props.readOnly) + }, [field.value, props.readOnly]) return ( <>