bootstrap-ruby / bootstrap_form

Official repository of the bootstrap_form gem, a Rails form builder that makes it super easy to create beautiful-looking forms using Bootstrap 5.
MIT License
1.64k stars 352 forks source link

text_field options hide_label and label_as_placeholder not working #621

Closed elbarto132 closed 2 years ago

elbarto132 commented 2 years ago

The options hide_label and label_as_placeholder on a text field aren't working. Setting these options to true adds a class sr-only to the label, but it looks like this class doesn't exist in Bootstrap 5 anymore.

A workaround is to add this CSS: .sr-only { display: none; }

lcreid commented 2 years ago

Thanks for reporting this, and sorry you ran into this problem. I believe this is fixed by #615 . You can use the gem from GitHub until we do the next release. Change your Gemfile for bootstrap_form to:

gem "bootstrap_form", git: "https://github.com/bootstrap-ruby/bootstrap_form/"

and then do a bundle update.

Please let us know if that fixes the issue. Thanks again for taking the time to report this issue.

elbarto132 commented 2 years ago

Using gem "bootstrap_form", git: "https://github.com/bootstrap-ruby/bootstrap_form/" throws a git error, but gem "bootstrap_form", git: "https://github.com/bootstrap-ruby/bootstrap_form/", branch: "main" works and it fixes the problem.

lcreid commented 2 years ago

Sorry. I thought it defaulted to branch: "main" but obviously it doesn't. Thanks for letting me know. I'll close this. If you think I shouldn't, please re-open it.

rathboma commented 2 years ago

A workaround for those wanting to use official releases (using scss):

.sr-only {
  @extend .visually-hidden;
}