Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pwa 3065::When the button "sign in" is pressed by the keyboard, nothing happens. #4064

Merged
merged 12 commits into from
Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -131,6 +131,7 @@ test('returns correct shape', () => {
"shouldRender": false,
},
"setFormApi": [Function],
"signinHandleEnterKeyPress": [Function],
}
`);
});
10 changes: 10 additions & 0 deletions packages/peregrine/lib/talons/SignIn/useSignIn.js
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@ export const useSignIn = props => {
},
...recaptchaData
});

const token = signInResponse.data.generateCustomerToken.token;
await setToken(token);

@@ -173,6 +174,14 @@ export const useSignIn = props => {
};
}, [handleCreateAccount]);

const signinHandleEnterKeyPress = useCallback(() => {
event => {
if (event.key === 'Enter') {
handleSubmit();
}
};
}, [handleSubmit]);

const errors = useMemo(
() =>
new Map([
@@ -186,6 +195,7 @@ export const useSignIn = props => {
errors,
handleCreateAccount,
handleEnterKeyPress,
signinHandleEnterKeyPress,
handleForgotPassword,
handleSubmit,
isBusy: isGettingDetails || isSigningIn || recaptchaLoading,
2 changes: 2 additions & 0 deletions packages/venia-ui/lib/components/SignIn/signIn.js
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ const SignIn = props => {
errors,
handleCreateAccount,
handleEnterKeyPress,
signinHandleEnterKeyPress,
handleForgotPassword,
handleSubmit,
isBusy,
@@ -119,6 +120,7 @@ const SignIn = props => {
<Button
priority="high"
type="submit"
onKeyDown={signinHandleEnterKeyPress}
data-cy="SignInButton-root_highPriority"
disabled={isBusy}
>