Best practices when it comes to login / sign up forms

This article summarizes everything and gives reasoning but it boils down to:

  1. Set autocomplete to input fields
  2. Select the correct type value for input fields
  3. All clickable elements should use <button> or <a>, not <div> or <span>
  4. Wrap input fields and the submit <button> inside <form> tags
  5. Connect <label> and <input> tags, avoid placeholder
  6. Wrap checkboxes inside <label> tags
  7. Set visible :focus state to UI
  8. Mark invalid fields for screen-readers
  9. Prevent validation in the middle of input. onChange instead of onKeyup
  10. Disable submitting when waiting for a network request. Prevents forms from being sent twice
  11. When making network requests handle loading states and network errors