diff --git a/src/ui/components/SignMessageButton/SignMessageButton.tsx b/src/ui/components/SignMessageButton/SignMessageButton.tsx index 496e79880..c8ad7e9b8 100644 --- a/src/ui/components/SignMessageButton/SignMessageButton.tsx +++ b/src/ui/components/SignMessageButton/SignMessageButton.tsx @@ -106,7 +106,7 @@ export const SignMessageButton = React.forwardRef(function SignMessageButton( // there is a small delay after using a holdable button // button should be disabled after successful sign to prevent a duplicating call - const disabled = isLoading || isSuccess; + const disabled = isLoading || Boolean(holdToSign && isSuccess); const title = buttonTitle || 'Sign'; return isDeviceAccount(wallet) ? ( diff --git a/src/ui/components/SignTransactionButton/SignTransactionButton.tsx b/src/ui/components/SignTransactionButton/SignTransactionButton.tsx index 85e76f22d..6df66db7d 100644 --- a/src/ui/components/SignTransactionButton/SignTransactionButton.tsx +++ b/src/ui/components/SignTransactionButton/SignTransactionButton.tsx @@ -48,7 +48,7 @@ export const SignTransactionButton = React.forwardRef( buttonTitle?: React.ReactNode; buttonKind?: ButtonKind; isLoading?: boolean; - holdToSign: boolean; + holdToSign: boolean | null; }, ref: React.Ref ) { @@ -85,7 +85,8 @@ export const SignTransactionButton = React.forwardRef( // there is a small delay after using a holdable button // button should be disabled after successful sign to prevent a duplicating call - const disabled = isLoading || sendTxMutation.isSuccess || disabledAttr; + const disabled = + isLoading || (holdToSign && sendTxMutation.isSuccess) || disabledAttr; const title = buttonTitle || 'Confirm'; return isDeviceAccount(wallet) ? ( diff --git a/src/ui/pages/History/AccelerateTransactionDialog/CancelTx/CancelTx.tsx b/src/ui/pages/History/AccelerateTransactionDialog/CancelTx/CancelTx.tsx index 661197877..f15207fb6 100644 --- a/src/ui/pages/History/AccelerateTransactionDialog/CancelTx/CancelTx.tsx +++ b/src/ui/pages/History/AccelerateTransactionDialog/CancelTx/CancelTx.tsx @@ -218,7 +218,7 @@ function CancelTxContent({ wallet={wallet} ref={signTxBtnRef} onClick={() => sendTransaction()} - holdToSign={Boolean(preferences.enableHoldToSignButton)} + holdToSign={preferences.enableHoldToSignButton} /> ) : null} diff --git a/src/ui/pages/History/AccelerateTransactionDialog/SpeedUp/SpeedUp.tsx b/src/ui/pages/History/AccelerateTransactionDialog/SpeedUp/SpeedUp.tsx index 713cdaafe..7f6995cc5 100644 --- a/src/ui/pages/History/AccelerateTransactionDialog/SpeedUp/SpeedUp.tsx +++ b/src/ui/pages/History/AccelerateTransactionDialog/SpeedUp/SpeedUp.tsx @@ -212,7 +212,7 @@ export function SpeedUp({ wallet={wallet} ref={signTxBtnRef} onClick={() => sendTransaction()} - holdToSign={Boolean(preferences.enableHoldToSignButton)} + holdToSign={preferences.enableHoldToSignButton} /> ) : null} diff --git a/src/ui/pages/SendTransaction/SendTransaction.tsx b/src/ui/pages/SendTransaction/SendTransaction.tsx index 47778d916..b1d5aeb79 100644 --- a/src/ui/pages/SendTransaction/SendTransaction.tsx +++ b/src/ui/pages/SendTransaction/SendTransaction.tsx @@ -648,6 +648,7 @@ function SendTransactionContent({ tx: ethers.providers.TransactionResponse ) { if (preferences?.enableHoldToSignButton) { + // small delay to show success state to the user before closing the popup await wait(500); } const windowId = params.get('windowId'); @@ -809,7 +810,7 @@ function SendTransactionContent({ ? 'Proceed Anyway' : undefined } - holdToSign={Boolean(preferences.enableHoldToSignButton)} + holdToSign={preferences.enableHoldToSignButton} /> ) : null} diff --git a/src/ui/pages/SignInWithEthereum/SignInWithEthereum.tsx b/src/ui/pages/SignInWithEthereum/SignInWithEthereum.tsx index 542f5d58e..3435de530 100644 --- a/src/ui/pages/SignInWithEthereum/SignInWithEthereum.tsx +++ b/src/ui/pages/SignInWithEthereum/SignInWithEthereum.tsx @@ -97,6 +97,7 @@ export function SignInWithEthereum() { onMutate: () => 'signMessage', onSuccess: async (signature) => { if (preferences?.enableHoldToSignButton) { + // small delay to show success state to the user before closing the popup await wait(500); } handleSignSuccess(signature); diff --git a/src/ui/pages/SignMessage/SignMessage.tsx b/src/ui/pages/SignMessage/SignMessage.tsx index 68d18841b..d98be5c2e 100644 --- a/src/ui/pages/SignMessage/SignMessage.tsx +++ b/src/ui/pages/SignMessage/SignMessage.tsx @@ -84,6 +84,7 @@ function SignMessageContent({ onMutate: () => 'signMessage', onSuccess: async (signature) => { if (preferences?.enableHoldToSignButton) { + // small delay to show success state to the user before closing the popup await wait(500); } handleSignSuccess(signature); @@ -179,7 +180,7 @@ function SignMessageContent({ ref={signMsgBtnRef} wallet={wallet} onClick={() => personalSign()} - holdToSign={preferences?.enableHoldToSignButton} + holdToSign={preferences.enableHoldToSignButton} /> ) : null} diff --git a/src/ui/ui-kit/Button/HoldableButton.tsx b/src/ui/ui-kit/Button/HoldableButton.tsx index ee4100030..a639e82f4 100644 --- a/src/ui/ui-kit/Button/HoldableButton.tsx +++ b/src/ui/ui-kit/Button/HoldableButton.tsx @@ -155,9 +155,11 @@ const ButtonElement = ( }} onMouseUp={handleMouseUp} onKeyDown={(e) => { - e.preventDefault(); - if (e.key === 'Enter' && innerState === 'idle') { - handleMouseDown(); + if (e.key === 'Enter') { + e.preventDefault(); + if (innerState === 'idle') { + handleMouseDown(); + } } }} onKeyUp={handleMouseUp}