Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Twig][Bootstrap 4 Theme]: Displaying errors like in official docs #29986

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

Closed
FlashBlack opened this issue Jan 25, 2019 · 6 comments
Closed

[Twig][Bootstrap 4 Theme]: Displaying errors like in official docs #29986

FlashBlack opened this issue Jan 25, 2019 · 6 comments

Comments

@FlashBlack
Copy link

FlashBlack commented Jan 25, 2019

Symfony version(s) affected: 4.2.2

Description

As for me, error displaying is much prettier with official bootstrap v4 component/forms.

How to reproduce

  1. config/packages/twig.yaml in "form_themes" put bootstrap_4_(horizontal)_layout.html.twig
  2. Create a form, cause a validation error

Possible Solution
MR: #29987

Additional context

Currect views:
2
Horizontal: 2_hor

Proposed:
1
Horizontal: 1_hor

@stof
Copy link
Member

stof commented Jan 26, 2019

Rendering the errors as part of the label was done in an effort to improve accessibility (the ERROR prefix was also part of that).
This indeed does not play well with the horizontal variant.

And putting the error in the place where Bootstrap expects it to be also makes sense from a compatibility point of view (we have no guarantee that our "hacked" usage of Bootstrap will keep working fine in future updates)

@Nyholm as you were the one doing that change in #24435 (and the related PR is essentially a revert of that one), could you participate here ?

@mmarton
Copy link

mmarton commented Jan 27, 2019

I've already tried and failed with this. :( I hope you will have better luck
#26461

@vudaltsov
Copy link
Contributor

vudaltsov commented Jan 29, 2019

I experienced troubles with errors in labels too. First of all because all of a sudden {{ form_widget() }} and {{ form_label() }} started working differently around some 3.4.x patch release which was kind of a BC break to be honest (see https://github.com/symfony/symfony/pull/24435/files). Second because my form layout became worse in places where invalid forms' labels were not supposed to expand. Finally I just created my own layout which I reuse in all projects using Bootstrap.

While I am certainly thumbs up for accessibility in general, I am not sure that Symfony should change how Bootstrap is designed. If I choose Bootstrap as a front-end library and use Symfony's BS form templates, I expect everything to work according to the BS documentation. It means that I accept how BS approaches layout and accessibility and other problems. That's my choice. If I want to make my forms more accessible, I should replace some twig blocks or choose another front-end framework or create an issue in https://github.com/twbs/bootstrap. By default I want to see everything working according to BS docs and defaults because Symfony is supposed to provide a TwigBridge for Bootstrap, not an opinionated modified version.

@javiereguiluz
Copy link
Member

@vudaltsov I fully agree with you. Moreover, anyone that reads Bootstrap docs can see that they care about accessibility a lot ... so their current approach it's probably pretty (or fully) accessible and we don't need to change it.

@mmarton
Copy link

mmarton commented Jan 29, 2019

I don't have a problem with symfony having it's own opinionated layout. Just don't name it bootstrap3/4 layout.

@xabbuh
Copy link
Member

xabbuh commented Feb 2, 2019

I am closing here as we already have #28086 which is the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants