TimeField: properly handle isRequired prop#772
Open
mkernohanbc wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes TimeField so the isRequired prop correctly drives both required behavior (e.g., data-required="true") and the visible “(required)” indicator, by consuming isRequired from React Aria render props instead of destructuring it out of the component props.
Changes:
- Stop destructuring
isRequiredfromTimeFieldprops so it remains included in...propspassed toReactAriaTimeField. - Read
isRequiredfrom theReactAriaTimeFieldrender-props state to render the “(required)” label consistently with other components.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR fixes a mistake in how the
isRequiredprop is used in TimeField that surfaced during some testing work.Previously,
isRequiredwas destructured in order to render the visible "(required)" label — but this silently broke the actual required-input functionality, resulting indata-required="true"not being set on the TimeField.This change removes this explicit destructuring, and instead properly passes it as a render prop (matching the pattern in other components) to handle the display of the label. With this change,
data-required="true"is now also properly set on the TimeField.