-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Bootrap 4 Theme] Form validation errors do not match official Bootstrap documentation #28086
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
Comments
Can you confirm that #27892 will fix your issue? |
@xabbuh Yes, this should fix my issue 😉 |
Thank you for this issue. I have reviewed this and discussed it many times but the solution is more tricky that you first expect. I do agree that there is an issue. However the implementation is intentional. We really want the error messages in the labels because that helps screen readers and blind users. At #eu-fossa we were a bunch of people that sat done and discussed this to find a solution. We came up with the following solution:
<div class="error">
<label for="username">
<strong>Error:</strong> <!-- Maybe we should add line this too? -->
Username:
</label>
<input type="text"
name="username"
id="username"
aria-describedby="username-desc">
<span id="username-desc">The username is already taken.</span>
</div> |
Sounds like a great solution to me :-) Is there an ETA for the implementation of this solution? |
As far as I know. Nobody is correctly working on it. Feel free to write a PR. If you do, please make a comment here. |
I will give it a try next week :-) But I have one question regarding the |
Tell me if I wrong but IMO it's not to us to defined how should be rendered errors with Bootstrap (inside or outside label for accessibility purposes). Bootstrap documentation already specify how errors should be rendered, if we implement a Bootstrap form theme we must follow Bootstrap documentation and not make our own opinionated layout. But maybe I miss something :). |
any updates ? |
Not yet as I did not have any time to work on this. |
Hey, thanks for your report! |
Hello? This issue is about to be closed if nobody replies. |
I am using the following snippet as a workaround (unfortunately I do not know where I found this snippet, so credets for whoever wrote this):
|
Here's my workaround for Symfony 4.4. The code is taken from bootstrap_4_layout.html.twig, I commented the extra errors stuff in
|
Hey, thanks for your report! |
On my end: I'm still relying on the workaround I mentioned above. |
I resigned myself and just accept that the implementation difference should be in your own cookbook |
Same here - I just went with the workaround :-) |
Hey, thanks for your report! |
Friendly reminder that this issue exists. If I don't hear anything I'll close this. |
Fixed by #46414 IIUC |
Symfony version(s) affected: (at least) 4.1.2
Description
When enabling the Bootrap 4 form theme in the latest version of Symfony, validation errors are not displayed correctly*:
The error is displayed underneath the label instead of the actual widget. Fix: move the corresponding block to the correct position.
*) "correctly" means that is looks different from the original documentation here
How to reproduce
Possible Solution
As suggested above.
The text was updated successfully, but these errors were encountered: