:valid and :invalid CSS selectors #3427
-
The react-hook-form library claims to embrace native browser validation rules. However, an input that has failed validation has native validity attribute set to "true" (https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) . Therefore CSS selectors :valid and :invalid does not apply properly preventing their usage for styling input elements. How to reproduce
Expectations
I am aware that I can set my custom styles based on the errors passed by react-form-hook. But it would be really great having those native :invalid :valid selectors working out of the box. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
now we still embrace HTML native validation rules, we used to have this feature at v3, but the usage is very low... consider all those external controlled component doesn't even forward the ref, it's a challenge to make it work to cross the board and also react native. you can vote on this: we will consider to bring it back: |
Beta Was this translation helpful? Give feedback.
-
I vote for adding this option too. |
Beta Was this translation helpful? Give feedback.
-
please update this feature request: #2659 |
Beta Was this translation helpful? Give feedback.
-
cast your vote here: https://twitter.com/HookForm/status/1402189525057638413 |
Beta Was this translation helpful? Give feedback.
now we still embrace HTML native validation rules, we used to have this feature at v3, but the usage is very low... consider all those external controlled component doesn't even forward the ref, it's a challenge to make it work to cross the board and also react native.
you can vote on this: we will consider to bring it back:
#2659