Use -of-type instead of -child to accommodate hidden inputs#28997
Use -of-type instead of -child to accommodate hidden inputs#28997mermop wants to merge 9 commits intotwbs:masterfrom
Conversation
|
Hi @mermop, welcome here! I'm not eager to merge this though, we shouldn't change our code because another framework renders their markup different, especially if it's just a hidden input. I guess you better suggest a PR for Rails collection_check_box to fix this. Ping @twbs/css-review for second opinion. |
|
I'd be in favor of this change, as |
|
My impression is that it's reasonably common to have a hidden input alongside a checkbox or group of checkboxes so that the form submits a null value if they are unchecked, not just in Rails - but it's a commonly used framework and where I came across this, so I thought it was worth including references to behaviour there. There are other use cases though - there are lots of reasons that the first or last child of a There are some examples of how |
MartijnCuppens
left a comment
There was a problem hiding this comment.
This change won't break anything in normal circumstances and if it could fix your problem (and possibly other problems) it's fine by me.
|
Nice catch, @ysds! |
I wonder what this will break
|
Hmm, interesting! So in that case, there's a With this change I think you'd be able to instead use: That only uses one But doing that I still see: Which is also what it looks like without this change - because of the I've removed that, I can't quite figure out what it's there for, but I'm sure it was there for a reason and will break something somewhere else - do you have a visual diff tool or anything? |
Nope I'm ok with unnesting the |
We support this and making any changes here would be a breaking change. https://getbootstrap.com/docs/4.3/components/button-group/#nesting |
|
I'm going to close this, since the solution provided will break the droplefts or nested button groups. On the other hand this feels like a fix for a case we don't support. |


Hello friends! Long-time listener, first-time caller 📞
This PR changes the selector for resetting rounded corners of
btnelements inbtn-groupsfromfirst-childtofirst-of-typeto accommodate hidden inputs in sets of checkboxes or radio buttons.The Rails collection_check_box or Simple Form or Formtastic all add a hidden input either at the beginning or end of a collection of check boxes or radio buttons. This makes implementing groups of checkboxes or radio buttons as per the documentation either painful or slightly ugly.
I initially put this PR in the bootstrap-rubygem repo
Markup using Rails collection_check_boxes
Screenshot using first-child/last-child
Screenshot using first-of-type/last-of-type