Skip to content

fix: text field validation for minLength: 1, required: false #13124

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcgsville
Copy link
Contributor

@jcgsville jcgsville commented Jul 10, 2025

Fixes #13113

How?

Does not rely on JS falseyness, instead explicitly checking for null & undefined

I'm not actually certain this is the approach we want to take. Some people might interpret "required" as not null, not-undefined and min length > 1 in the case of strings. If they do, this change to the behavior in the not-required case will break their expectations

@jcgsville jcgsville changed the title fix text field validation for minLength: 1, required: false fix: text field validation for minLength: 1, required: false Jul 10, 2025
@jessrynkar
Copy link
Member

@jcgsville this all looks good - however your test needs to be updated, it has expect(result).toBe(true) which is the current behavior, after this change you will want it to be expect(result).toBe('validation:shorterThanMax').

@jcgsville
Copy link
Contributor Author

Thanks @jessrynkar. Sorry for the noise, I just let the pipeline run the tests rather than get a full local setup. Fixing now

@jcgsville
Copy link
Contributor Author

I think the failing CI step is unrelated to my change? It's a bundle size check, if I understand correctly. My change should not have affected bundle size. Gonna do a no-op commit to rerun CI

@jcgsville
Copy link
Contributor Author

Not sure why that check is failing consistently. May need some help

@jessrynkar
Copy link
Member

@jcgsville I think it's just flaky, I'm rerunning them now

@jessrynkar jessrynkar enabled auto-merge (squash) July 11, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

minLength: 1 and required: false do not work for text field
2 participants