You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[EuiFieldText] required prop validating immediately, not on blur #4710
Validate on blur
Validation should occur on blur from an input field. The submit button should be active by default, then show errors after click. Error messages should be specific to the situation.
Yes, we intentionally override the invalid color with the focus color when the input is in focus. If validation only occurs onBlur then the invalid marker would continue to be present even if they've changed their input to be valid.
Appreciate the feedback here, but not something we will be changing as it was a conscious decision.
Apologies, the fork link was supposed to take you to a codepen.
Ignore focus, that was needed so my patch would work.
You'll see in the codepen that the first and second fields are invalid; all I've done is add the required prop to them.
Activity
j-m commentedon Apr 14, 2021
Appears to just be a styling issue, resolved with
Essentially just replacing
with
cchaos commentedon Apr 14, 2021
Yes, we intentionally override the invalid color with the focus color when the input is in focus. If validation only occurs
onBlurthen the invalid marker would continue to be present even if they've changed their input to be valid.Appreciate the feedback here, but not something we will be changing as it was a conscious decision.
j-m commentedon Apr 14, 2021
Apologies, the fork link was supposed to take you to a codepen.
Ignore
focus, that was needed so my patch would work.You'll see in the codepen that the first and second fields are invalid; all I've done is add the
requiredprop to them.j-m commentedon Jun 15, 2021
@cchaos Reading your comments back, I think there was a misunderstanding here and believe this issue should be reopened.
To elaborate, if a field is
requiredthen EUI will immediately show it as invalid, even if the user hasn't attempted to enter anything.cchaos commentedon Jul 19, 2021
Unfortunately that's just how browser's interpret
requiredon empty inputs. Here's a blank codepen showing the basic implementation: https://codepen.io/clhorn99/pen/bGBdbaVAnd an explanation from MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required#constraint_validation