question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authenticator components should use form onSubmit method

See original GitHub issue

Is your feature request related to a problem? Please describe.

I noticed that the Authenticator UIs do not actually use a <form /> element, but instead just listen to an onclick handler on the submit button for each one, e.g., SignIn.jsx.

As a result, pressing enter in a form element doesn’t submit it. I believe this also impacts mobile where you can often submit a form from a keyboard option while inside a field instead of explicitly tapping the submit button. More generally, the standard expectation for how a form works is not met as a result of submit being handled in the way it currently is.

Describe the solution you’d like

I would like the Authenticator components, e.g., SignIn.jsx, SignUp.jsx, VerifyPassword.jsx, etc. (and for the other JS libraries too in addition to React), to get wrapped in a <form /> with an onClick method matching the previous onClick of the submit buttons and for the buttons to simply be changed to a button of type="submit" without an onClick handler.

The only quirk, is that I noticed the FederatedSignin gets triggered for Google sometimes… one workaround is to move the federated signin buttons outside of the form.

Describe alternatives you’ve considered

The only alternative I’ve found is to write my own forms, which sort of defeats the purpose of this library.

Additional context

I noticed these other closed issues on this topic (https://github.com/aws-amplify/amplify-js/issues/2085 and https://github.com/aws-amplify/amplify-js/issues/1019), however, I hope this one provides some more context and a clearer path forward.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
haverchuckcommented, Dec 11, 2018

@mrcoles - Thanks for submitting this. I was thinking along similar lines myself.

0reactions
github-actions[bot]commented, Jun 11, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use Forms in React - Robin Wieruch
How to use Forms in React by example. You will learn how to create a form template in a React functional component with...
Read more >
How onsubmit Event work in JavaScript? Examples - eduCBA
The onsubmit event is performed the triggers is based upon the submit function whenever the client user request in the form-wise data is...
Read more >
Build a React App with Authorization and Authentication
First, create a React form for the post. We'll again use React Router to send the name of the post to the component....
Read more >
Using React Hook Form in component tests | by Adam J. Arling
In our test above, we wrap the component we're testing with React Hook Form's <FormProvider /> and can initialize the form with some...
Read more >
How To Build Forms in React | DigitalOcean
Now you have a basic form that handles the submit event inside the React component. You've connected it to your JSX using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found