fix(forms): colour a control that is already known to be invalid - #8215
Closed
talissoncosta wants to merge 1 commit into
Closed
fix(forms): colour a control that is already known to be invalid#8215talissoncosta wants to merge 1 commit into
talissoncosta wants to merge 1 commit into
Conversation
Input only shows the invalid state after a blur, so a form submitted with Enter shows the error text with a grey border. autoValidate already meant "do not wait for a touch", it was just seeded into state at mount and so could not react to an error arriving later. Reading it live fixes that, and InputGroup's isInvalid prop now reaches the control instead of only setting a class on the wrapper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Split out of #8177, where it was scope creep.
A text field only turns red once it has been blurred. Submit a form with
Enter and you get the error message underneath a grey border, so nothing
points at the field that is wrong.
autoValidatealready meant "do not wait for the field to be touched", but itwas copied into state at mount, so it could not react to an error arriving
later. Reading it live is the fix:
InputGroupalready had anisInvalidprop, but it only put a class on thewrapper and never reached the control. It now forwards to
Input.No new prop, and no call site has to change.
How did you test this code?
The behaviour is opt-in, so the 100-odd existing
InputGroupcall sites areunaffected:
isInvalidcurrently has no consumers on main, andautoValidatehas exactly one (
RegexTester), which passes a statictrueand so behavesidentically either way.
Components/Forms/InputGroup: the new InvalidBeforeBlur story should show a red border on an untouched field. On main the same story is grey.Components/Forms/Inputstories unchanged.