-
-
Notifications
You must be signed in to change notification settings - Fork 78.5k
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
WIP Initial naive form validation fix #28995
Conversation
@mdo i remembered you discussed potential use of data attributes for this ... here's the first naive stab at it. apart from the general ugliness of the code, one aspect that's still not ideal is that the feedback does show dynamically based on validity of the form control, meaning that the problem will still happen that if there was an initial feedback which is then tied to the control, if the validity changes dynamically (after the first submit), the feedback may be hidden, but it's still associated via |
for this proof of concept, only fiddled with that first form at https://deploy-preview-28995--twbs-bootstrap.netlify.com/docs/4.3/components/forms/#custom-styles |
I like the idea. I would also provide an example with as well the |
Like I said in Slack, I think it's a good idea but for me, it lacks of features, just accessibility, and a simple validation isn't enough for a core components |
@Johann-S well, put it this way: the current use of just CSS to show/hide validation messages is not accessible. we either fix that in our core (and if it requires JS, add it as a plugin, as we can't expect authors to copy/paste an enormous chunk of code just to make things run correctly when they use it), or we ditch the validation messages altogether. |
For me, the fact the validation errors aren't actually conveyed properly is a blocker. Annoyed I've not caught that sooner in v4, but...it is what it is. |
Does this still apply to v5? |
yes, https://v5.getbootstrap.com/docs/5.0/forms/validation/ still has issues - custom styles and tooltips examples, the errors are not associated with the form controls and not announced by AT. also, in the support elements example, the errors are likewise not associated. for custom and tooltip, this needs javascript to dynamically inject the error, OR to dynamically add/remove the |
This one is pretty out of date, is it still relevant? |
the original problem still persists, but this got scuppered by my lack of JS chops / how to make the scripting etc apply automagically. |
@patrickhlauke can you explain a bit more in detail what you are missing? Maybe @GeoSot could help us out here. |
what's really missing is some kind of clean way to actually make this part of Bootstrap's JS. how to generalise this somehow to make it easily usable, automatically adding/removing the |
Superseded by #34043 |
A first attempt at mocking up the actual JavaScript behavior for correct custom form validation handling
Not mergeable yet, just pushing this as a proof of concept. This should really be rolled into a proper plugin/JavaScript behavior.
x-ref #28414