django-crispy-forms / crispy-bootstrap5

Bootstrap5 template pack for django-crispy-forms
MIT License
451 stars 72 forks source link

Used <fieldset> and <legend> to group related inputs. #158

Closed smithdc1 closed 9 months ago

smithdc1 commented 10 months ago

Fixes #152.

@danlerche -- do you have capacity to review this? Does it solve your issue?

danlerche commented 10 months ago

@smithdc1 Sorry for delay. Yes this good good! #152

smithdc1 commented 10 months ago

Hi @danlerche

Sorry for delay.

I thought you came back very quickly to this given the time it took me to consider a solution!

I've also asked the Django accessibility team to see if anyone there has time to review. Will leave this a little while to see if anyone has capacity (no rush or pressure to get this done).

smithdc1 commented 10 months ago

image

<legend> has a larger font-size than <label>.

But it's ok for horizontal forms as col-form-label is used.

image

Here's a ticket against bootstrap https://github.com/twbs/bootstrap/issues/27805. I think we can set the font-size on the legend to the same size as that used for form-label.

smithdc1 commented 9 months ago

Thanks for checking @knyghty !

eriktelepovsky commented 6 months ago

Is there a way how to disable this new feature?

smithdc1 commented 6 months ago

If you'd like the previous behaviour (which would be less accessible for your users) then you could copy the template from the previous release to your project and override the default.

https://django-crispy-forms.readthedocs.io/en/latest/layouts.html#overriding-layout-objects-templates

eriktelepovsky commented 6 months ago

Is it at least possible to make the CSS same as before? This update breaks the appearance of the forms.

smithdc1 commented 6 months ago

Which change CSS change is causing an issue for you?

eriktelepovsky commented 6 months ago

Basically everything what looks like differently or is inherited from fieldset. Probably mostly the font size. I use many fields in my form and some fields contain widgets for multiple values (date ranges, inputs for age range, multiple checkbox choices). This update visually breaks the overall appearance of the whole form. It took me a while to debug why it actually happened until I noticed the update in the templates. I did not expect such behavior during update and I think such change should be optional maybe or at least non-breaking.