I spotted this problem adding a site search form that refused to display inline. Before creating a subtheme component with lots of custom CSS, I found the documentation that says that moving from Bootstrap 4 to 5:
Breaking Dropped form-specific layout classes for our grid system. Use our grid and utilities instead of .form-group, .form-row, or .form-inline.
The solution for my search form block was to replace form-inline in the <form> class list with d-flex flex-row flex-wrap.
I'll see, later, if I can turn this into a patch / merge-request. Although ideally someone who knows this base theme better than I do (and who probably knows the Bootstrap framework better than me too) would do this, because this is a theme with lots of components. Proposing something that fixes the bits of it used by my sites does not mean this is resolved for everyone, and I might miss things. So for now I'll leave this here.
Issue fork radix-3507333
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 6.0.x
changes, plain diff MR !134 /
changes, plain diff MR !132
- 3507333-bootstrap-5-removed
changes, plain diff MR !133
Comments
Comment #2
doxigo commentedHey James, Thanks for a nice find, please provide the MR, I appreciate it, thanks
Comment #4
jamesoakleySo, I think that merge request is the way to do it.
It assumes that the bootstrap classes I've added in place of form-inline are the correct ones. I'd be glad for someone to check that. (It works on the site I'm testing on, at all browser widths, but I'm not 100% sure this is the canonical Bootstrap way to do this).
Doing it in the Form component means that any templates that call
radix:formwithis_inline:truewill pick up the new markup without having to change every templates. So I think is the DRY way to fix this.Comment #5
doxigo commentedThanks James, I'm not sure if
flex-rowandflex-wrapare needed, are they? can you test without? if so update the MR?Comment #6
jamesoakleyAlso just triggered an error on another pageload, so I'm just investigating that.
Comment #7
jamesoakleyOK
My twig bug was because of a hastily (and embarrassingly) mistyped ternary operator. Oops.
I can confirm that you don't need flex-row, because that's the default
It seems that you don't need flex-wrap either, but I'm testing on the search form which is pretty small. The default is flex-nowrap, and I'm not clear what happens if it's a bigger inline form. I can put flex-wrap back if that's desirable, but for the time-being the latest iteration of the MR works fine for me.
Comment #9
doxigo commentedPerfect work James, merged
Comment #10
danchadwick commentedEh, this is a breaking change. I use form-inline for a number of custom styles. I don't think we can just remove that class without breaking sites.
Suggest we add to form-inline, rather than replace it. @doxigo: thoughts?
Comment #11
danchadwick commentedComment #15
jamesoakleyI'd be inclined to agree.
form-inlinewon't get picked up by Bootstrap to do anything.But you're quite right - that doesn't mean people won't be picking up on the class to do their own CSS.
Having got into a tangle with how Gitlab's merge requests work when you making further changes to the same issue fork, I think the latest MR is now what's needed. Tested and it still works, but also leaves
form-inlinein place.Comment #16
doxigo commentedHey Dan, you are correct, I missed the breaking change part, it definitely is. We should ideally keep it and also add the new d-flex class.
Thanks for the updated MR James
Comment #17
doxigo commentedThe MRs were a bit confusing, I just kept both the
form-inlineandd-flexComment #19
jamesoakleySorry for the confusion - sometimes MR aren't the easiest way to put a change in. Yes, keeping both is correct - one to ensure it works with Bootstrap 5, one to avoid breaking any sites that have built CSS off the old classes. Thanks for fixing