From b2574884d2f0e2633f3c752bd43e97d6dafbf3ad Mon Sep 17 00:00:00 2001 From: Raghavendra Date: Tue, 28 Feb 2023 18:26:35 +0530 Subject: [PATCH 1/5] BUG#-3064 When the button cancel beside create account is pressed by the keyboard, nothing happens --- packages/venia-ui/lib/components/CreateAccount/createAccount.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/venia-ui/lib/components/CreateAccount/createAccount.js b/packages/venia-ui/lib/components/CreateAccount/createAccount.js index 55927ffb1f..1def45c3ae 100644 --- a/packages/venia-ui/lib/components/CreateAccount/createAccount.js +++ b/packages/venia-ui/lib/components/CreateAccount/createAccount.js @@ -47,6 +47,7 @@ const CreateAccount = props => { type="button" priority="low" onClick={handleCancel} + onKeyDown={handleCancel} > Date: Tue, 28 Feb 2023 19:11:42 +0530 Subject: [PATCH 2/5] BUG#-3064 When the button cancel beside create account is pressed by the keyboard, nothing happens --- .../lib/talons/CreateAccount/useCreateAccount.js | 9 +++++++++ .../lib/components/CreateAccount/createAccount.js | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js index c4bbfe946b..b4e7200bdb 100644 --- a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js +++ b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js @@ -85,6 +85,14 @@ export const useCreateAccount = props => { onCancel(); }, [onCancel]); + const handleCancelKeyPress = useCallback(() => { + event => { + if (event.key === 'Enter') { + handleCancel(); + } + }; + }, [handleCancel]); + const handleSubmit = useCallback( async formValues => { setIsSubmitting(true); @@ -180,6 +188,7 @@ export const useCreateAccount = props => { mergeCarts, getUserDetails, fetchUserDetails, + handleCancelKeyPress, getCartDetails, fetchCartDetails, onSubmit, diff --git a/packages/venia-ui/lib/components/CreateAccount/createAccount.js b/packages/venia-ui/lib/components/CreateAccount/createAccount.js index 1def45c3ae..31fa9a17a1 100644 --- a/packages/venia-ui/lib/components/CreateAccount/createAccount.js +++ b/packages/venia-ui/lib/components/CreateAccount/createAccount.js @@ -32,6 +32,7 @@ const CreateAccount = props => { handleCancel, handleSubmit, handleEnterKeyPress, + handleCancelKeyPress, isDisabled, initialValues, recaptchaWidgetProps @@ -47,7 +48,7 @@ const CreateAccount = props => { type="button" priority="low" onClick={handleCancel} - onKeyDown={handleCancel} + onKeyDown={handleCancelKeyPress} > Date: Wed, 1 Mar 2023 13:38:08 +0530 Subject: [PATCH 3/5] BUG#-3064 When the button cancel beside create account is pressed by the keyboard, nothing happens --- .../__tests__/__snapshots__/useCreateAccount.spec.js.snap | 1 + packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/peregrine/lib/talons/CreateAccount/__tests__/__snapshots__/useCreateAccount.spec.js.snap b/packages/peregrine/lib/talons/CreateAccount/__tests__/__snapshots__/useCreateAccount.spec.js.snap index e681fb0e59..47c2adbc08 100644 --- a/packages/peregrine/lib/talons/CreateAccount/__tests__/__snapshots__/useCreateAccount.spec.js.snap +++ b/packages/peregrine/lib/talons/CreateAccount/__tests__/__snapshots__/useCreateAccount.spec.js.snap @@ -26,6 +26,7 @@ Object { "signInMutation" => null, }, "handleCancel": [Function], + "handleCancelKeyPress": [Function], "handleSubmit": [Function], "initialValues": Object { "customer": Object { diff --git a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js index b4e7200bdb..7e795e8c58 100644 --- a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js +++ b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js @@ -188,7 +188,6 @@ export const useCreateAccount = props => { mergeCarts, getUserDetails, fetchUserDetails, - handleCancelKeyPress, getCartDetails, fetchCartDetails, onSubmit, @@ -218,6 +217,7 @@ export const useCreateAccount = props => { errors, handleCancel, handleSubmit, + handleCancelKeyPress, initialValues: sanitizedInitialValues, isDisabled: isSubmitting || isGettingDetails || recaptchaLoading, recaptchaWidgetProps From dc62cc65a9de07be8a74d09c182c2a519cc87d05 Mon Sep 17 00:00:00 2001 From: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:53:26 +0530 Subject: [PATCH 4/5] Update useCreateAccount.js PWA-3064:: When the button "cancel" beside create account is pressed by the keyboard, nothing happens. --- packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js index 7e795e8c58..950109649b 100644 --- a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js +++ b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js @@ -175,6 +175,7 @@ export const useCreateAccount = props => { setIsSubmitting(false); } }, + [ cartId, generateReCaptchaData, From 979c7e492054184b662518b3e3997a36e208d8b8 Mon Sep 17 00:00:00 2001 From: glo82145 Date: Thu, 23 Mar 2023 13:08:27 +0530 Subject: [PATCH 5/5] PWA-3064::When the button cancel beside create account is pressed by the keyboard, nothing happens --- packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js index 950109649b..cc8953998a 100644 --- a/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js +++ b/packages/peregrine/lib/talons/CreateAccount/useCreateAccount.js @@ -175,7 +175,7 @@ export const useCreateAccount = props => { setIsSubmitting(false); } }, - + [ cartId, generateReCaptchaData,