Skip to content

fix(clerk-js): Form errors not displayed when form submitted with enter - #1097

Merged
panteliselef merged 1 commit into
mainfrom
elef/fix_error_enter_submit
Apr 21, 2023
Merged

panteliselef merged 1 commit into
mainfrom
elef/fix_error_enter_submit

Conversation

@panteliselef

@panteliselef panteliselef commented Apr 21, 2023 •

Copy link
Copy Markdown
Contributor

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

Description

  • npm test runs as expected.
  • npm run build runs as expected.

This is introduced due to enableErrorAfterBlur option from useFormControl that will delay an error message from being displayed until user moves clicks away from the field at least once.

This was a necessary change I had to make, in order to support displaying error messages while typing a password, but for better UX to delay giving users feedback for the errors until they move away (only the first time).

In order to fix this, I introduced a flag that keeps track of whether the form was submitted by pressing enter inside the field. If that's the case then I bypass that the logic above and directly display the error message.

@jit-ci jit-ci Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Great news! Jit hasn't found any security issues in your PR. Good Job! 🏆

@panteliselef
panteliselef merged commit 552c869 into main Apr 21, 2023
@panteliselef
panteliselef deleted the elef/fix_error_enter_submit branch April 21, 2023 16:29
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants