From ccf96a0579d9881421e430385d5cdf4ed0935ab1 Mon Sep 17 00:00:00 2001 From: truph01 Date: Fri, 23 May 2025 09:20:45 +0700 Subject: [PATCH 1/4] fix: tapping next with blank field cursor lost and keypad closed --- src/components/Form/FormWrapper.tsx | 1 + src/components/FormAlertWithSubmitButton.tsx | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/components/Form/FormWrapper.tsx b/src/components/Form/FormWrapper.tsx index c52c9949a37b..bf129ce421cd 100644 --- a/src/components/Form/FormWrapper.tsx +++ b/src/components/Form/FormWrapper.tsx @@ -178,6 +178,7 @@ function FormWrapper({ enterKeyEventListenerPriority={1} shouldRenderFooterAboveSubmit={shouldRenderFooterAboveSubmit} shouldBlendOpacity={shouldSubmitButtonBlendOpacity} + shouldPreventBlur /> ), [ diff --git a/src/components/FormAlertWithSubmitButton.tsx b/src/components/FormAlertWithSubmitButton.tsx index 9198aa04e63e..d536fbdb5840 100644 --- a/src/components/FormAlertWithSubmitButton.tsx +++ b/src/components/FormAlertWithSubmitButton.tsx @@ -74,6 +74,9 @@ type FormAlertWithSubmitButtonProps = { /** Whether to add a bottom padding to the button */ addButtonBottomPadding?: boolean; + + /** Prevents the button from triggering blur on mouse down. */ + shouldPreventBlur?: boolean; }; function FormAlertWithSubmitButton({ @@ -98,6 +101,7 @@ function FormAlertWithSubmitButton({ shouldRenderFooterAboveSubmit = false, shouldBlendOpacity = false, addButtonBottomPadding = true, + shouldPreventBlur = false, }: FormAlertWithSubmitButtonProps) { const styles = useThemeStyles(); const style = [footerContent && addButtonBottomPadding ? styles.mb3 : {}, buttonStyles]; @@ -130,6 +134,7 @@ function FormAlertWithSubmitButton({ danger={isSubmitActionDangerous} medium={useSmallerSubmitButtonSize} large={!useSmallerSubmitButtonSize} + onMouseDown={shouldPreventBlur ? (e) => e.preventDefault() : undefined} /> ) : (