Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix validations for controlled datefield components #5991

Merged

Conversation

tomekancu
Copy link
Contributor

Closes #5963

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@LFDanLu
Copy link
Member

LFDanLu commented Mar 8, 2024

GET_BUILD

@rspbot
Copy link

rspbot commented Mar 9, 2024

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

Just some small nit picks, but otherwise looks good to me, verified locally that a controlled isInvalid = false makes the FieldError no longer display errors in real time

@snowystinger
Copy link
Member

GET_BUILD

@rspbot
Copy link

rspbot commented Mar 10, 2024

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

I'm trying to determine with the controls added (thanks by the way) if changing between false and true should bring up the errorMessage again. it currently doesn't even if the error message showed before I put isInvalid into a controlled state

  1. set isInvalid to controlled state false
  2. enter a min-date
  3. set datefield to less than that
  4. put isInvalid into controlled state true

@tomekancu
Copy link
Contributor Author

@snowystinger that's exactly what this change does and what is expected in #5963.

Passing a controlled(true, false) value to isInvalid overrides the internal date field validation and prevents showing min/max errors.
If you want it back, you should pass undefined to isInvalid as an uncontrolled value.

LFDanLu
LFDanLu previously approved these changes Mar 15, 2024
Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@@ -82,8 +82,8 @@ function useFormValidationStateImpl<T>(props: FormValidationProps<T>): FormValid
}

// If the isInvalid prop is true, update validation result in realtime (controlled).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// If the isInvalid prop is true, update validation result in realtime (controlled).
// If the isInvalid prop is controlled, update validation result in realtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@yihuiliao
Copy link
Member

I just wanted to let you know that the team might be slow to review as we address some other priorities. We appreciate your understanding and apologize for the wait.

@LFDanLu
Copy link
Member

LFDanLu commented Apr 19, 2024

GET_BUILD

@rspbot
Copy link

rspbot commented Apr 19, 2024

@rspbot
Copy link

rspbot commented Apr 19, 2024

## API Changes

unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }

@snowystinger snowystinger merged commit 72775d2 into adobe:main Apr 22, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FieldError in DateRangePicker ignores isInvalid
7 participants