-
Notifications
You must be signed in to change notification settings - Fork 83
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
prop.pattern produces invalid html #605
Comments
Can we process the given regular expression so that it does give |
Looking at example online it seems like <label for="username">Username: (3-16 characters)</label>
<input id="username" name="username" type="text" value="Sasha" pattern="\w{3,16}" required />
<label for="pin">PIN: (4 digits)</label>
<input id="pin" name="pin" type="password" pattern="\d{4,4}" required /> |
I've added an overload that accepts a |
IHNO this never worked. Both React and MDN hints to the fact that
The wording on MDN is confusing:
But later, it does mention it as
Meaning that this is indeed the string representation of the pattern that can then be used to as an argument to |
The
prop.pattern
function available on input to provide a validation pattern takes a regular expression parameter and generates a js regex instead of the pattern only.For example
prop.pattern (System.Text.RegularExpressions.Regex "\d{2}:\d{2}:\d{2}")
producespattern="/\d{2}:\d{2}:\d{2}/gu"
What should be produced is
pattern="\d{2}:\d{2}:\d{2}"
.A workaround is to use
Interop.mkAttr "pattern" "\d{2}:\d{2}:\d{2}"
so it could replace the current implementation but it means the pattern validity is checked later.The text was updated successfully, but these errors were encountered: