-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
PR #25944 broke custom-control-label when empty #26453
Comments
The class custom-control-label has suddenly adopted position: relative - this was not in 4.1.0. Also, you might want to check what reboot.scss is doing exactly.
I would use display: block for this purpose since it is a custom control, then you can use position: relative as well, and margin-bottom: 0.5rem would only be appropriate for one specific control size; |
@asyncdesign : as I stated, the bug was introduced on 4.1.1, not 4.1.0. Please read me carefully. And I provided codepens using the default bootstrap builds so my reboot.scss cannot be causing this in any way! Here is the problematic commit : fc0fcc4. |
I know reboot isn't causing this issue, but just wanted to point out potential issues with the label having margin-bottom: .5rem, and having display: inline-block with position: relative doesn't make sense for a label. This was mainly for the Bootstrap devs to think about. But, if vertical-align: top was added to Bootstrap as you suggest, what will happen if the font-size is increased to say 1.3em? I would think that the text should be centered vertically within the label whatever the line-height is - same goes for the custom control. |
@asyncdesign : ok, sorry to have misunderstood you on this point. But I don't see the problem here though. The So I don't think it's related. But I agree about the intended alignment that would be broken with an increased I have to note on this subject that it is already broken without Maybe we should fill another bug about the vertical alignment of checkbox & text in this use case? But I'm under the impression that custom controls do not support changing font size at all (seeing how they're implemented right now). I think that ideally, the checkbox should appear 1.3× bigger if |
The cause of this bug is a lack of consideration for vertical alignment when no text in elements. I created a simple text case in https://codepen.io/anon/pen/yjPbxG. So an easy solution is adding Demo: https://codepen.io/anon/pen/GdOZjN But probably the ideal solution it is to rewrite to flexbox (#25184 as well as #25337 and #25828). I'd like to hear advice from @mdo before creating a PR. |
If rewriting it in flexbox solves this issue @ysds, I'd prefer that. It'd give folks even more control through utility classes. |
I agree that flexbox would probably solve most of the issues we are seeing with those and that it seems a much better solution overall. It might be a good idea to land a What are your thoughts on this @mdo? |
@mdo Thank! But the flex approach probably should be included in a minor (or major) update, because If the flexbox approach is successful (this means remove
<div class="form-check">
<input class="form-check-input position-static" type="checkbox">
</div> So, as @qraynaud said, it is better to add |
@ysds #25944 also breaks checkboxes in tables, see: https://codepen.io/anon/pen/mzLdwj . |
Empty labels are needed when using checkboxes in horizontal forms. If you let it empty in this use case on 4.1.1, the checkbox appears way off in the bottom: https://codepen.io/anon/pen/ZoJqyd
As you can see, it was working perfectly on 4.1.0: https://codepen.io/anon/pen/VxzEMp
I tried to look into every commit between 4.1.0 and 4.1.1 and found that PR #25944 was to blame. When I reverted its changes, the behavior was as before. Because this fix looked more than useful, I found a way to keep it and get my use case working as intended.
My proposed fix is to add
vertical-align: top
to thecustom-control-label
class:Here is a demo: https://codepen.io/anon/pen/NMvLEw
Since I don't know the bootstrap codebase & good practices, I hope someone else can come up with a PR though.
The text was updated successfully, but these errors were encountered: