Skip to content
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

Bootstrap template packs shouldn't include asterisk after required form fields #917

Closed
martey opened this issue Oct 23, 2019 · 3 comments
Closed

Comments

@martey
Copy link

martey commented Oct 23, 2019

  • Package version: master
  • Django version: n/a
  • Python version: n/a
  • Template pack: bootstrap, bootstrap3, and bootstrap4

Description:

All three of the Bootstrap template packs include an asterisk when a form field is required. While this is consistent with the other template packs and the documentation makes clear how to change it, this behavior is not consistent with how the Bootstrap framework renders forms.

No version of Bootstrap uses asterisks or any other visible indicator when form fields are required. In 2012, someone suggested adding asterisks to mark form fields as required but it was not added.

While it is not difficult to override the field template to remove the asterisk and you could argue that having a visual indicator for required fields is better for usability, I think the template packs should render forms as closely as possible as the frameworks that they are based on. This means removing the asteriskField class (and the asterisk) from required form fields in the Bootstrap template packs.

Since this is a backwards-incompatible change, I thought it was more prudent to create an issue instead of a pull request in order to start a discussion as to whether such a change would be acceptable.

@bryan-brancotte
Copy link
Member

Hi @martey

Thanks for your interest in the package. I agree with you that we should stick as close as possible to the framework, that's why we did #809 and #897, and have issue with FileField #918,#920.

Bootstrap does not use the asterisk, but crispy does since 7 years (at least, see bc14c9d) so clearly removing it would be some kind of backwards-incompatible issue.

As you pointed in the doc, it can easily be removed with a very small css snipet which is way much easier that to have templates without any asterisks. A compromise could be to have asterisks hidden by default, and revealed with css, but again as it's been 7 years, so users are use to it.

All the best

@martey
Copy link
Author

martey commented Oct 23, 2019

Would it at least make sense to remove the asterisk by default from the Bootstrap 4 template pack?

While this would still be technically be backwards-incompatible, it wouldn't affect users of the older Bootstrap 2 and Bootstrap 3 template packs. Since the Bootstrap 4 template pack has only been listed as being mature as of 1.8.0 (released less than a week ago), this is less likely to affect django-crispy-forms users who have been using the package for 7 years.

It also reduce the chances of this error propagating in the future (e.g. if templates for a future Bootstrap 5 template pack are copied from the existing Bootstrap 4 templates, like in 42618c0).

@carltongibson
Copy link
Collaborator

Hiya. We can assess BS5 when that comes up, but the CSS workaround is the way to go here. As @bryan-brancotte says, it's not something we can just change at this point. Sorry.

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

No branches or pull requests

3 participants