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

custom-checkbox broken when not using label next to checkbox #20730

Closed
Gillardo opened this issue Sep 16, 2016 · 8 comments
Closed

custom-checkbox broken when not using label next to checkbox #20730

Gillardo opened this issue Sep 16, 2016 · 8 comments

Comments

@Gillardo
Copy link

When reporting a bug, include:

  • Operating system and version (Windows)
  • Browser and version (Chrome 52.0.2743.116 m (64-bit))

image

Code to reproduce, as you can see i am using a form, so no need to have a description

    <div class="row form-group">
        <label class="col-sm-2 col-form-label">Legend</label>
        <div class="col-sm-10 col-md-7">
            <label class="custom-control custom-checkbox">
                <input type="checkbox" class="custom-control-input" />
                <span class="custom-control-indicator"></span>
            </label>
            <div class="text-muted">
                Display legend
            </div>
        </div>
    </div>

I have also tried adding a blank custom-control-description class to the html, so it looks like this, and again, still same line up issue

    <div class="row form-group">
        <label class="col-sm-2 col-form-label">Legend</label>
        <div class="col-sm-10 col-md-7">
            <label class="custom-control custom-checkbox">
                <input type="checkbox" class="custom-control-input" />
                <span class="custom-control-indicator"></span>
                <span class="custom-control-description"></span>
            </label>
            <div class="text-muted">
                Display legend
            </div>
        </div>
    </div>

If however, i use custom-control-description and ever in a single character, it lines up fine, as you can see here

image

@tomlutzenberger
Copy link
Contributor

Could be post it as a JSbin example?

@Gillardo
Copy link
Author

jsbin supplied with latest bootstrap css https://jsbin.com/kujilitawu/edit?html,css,output

@tomlutzenberger
Copy link
Contributor

Why is the text outside of the label? That's what it's for.
This solves it for me:
<span class="custom-control-description text-muted">Display legend</span>

@Gillardo
Copy link
Author

the text "Display Legend" is just the help text, the "label" is the "Legend" text

@tomlutzenberger
Copy link
Contributor

In this case your markup is basically wrong.

@Gillardo
Copy link
Author

How can my markup be wrong? I would like Legend to appear next to the checkbox, and my help text (which says Display Legend) to appear under it...

This <span class="custom-control-description text-muted">Display legend</span> does not solve the issue, as you can see in the jsbin, the label appears next to it still

@tomlutzenberger
Copy link
Contributor

As long as this is not a bug, I'd recommend to ask such questions on sites like stackoverflow or similar.

@cvrebert cvrebert changed the title custom-checkbox now broken when not using label next to checkbox custom-checkbox broken when not using label next to checkbox Sep 16, 2016
@stone1113
Copy link

wow吼厉害

mdo added a commit that referenced this issue Oct 27, 2016
Fixes #20730.

This change computes the minimum needed height of what a single line of text would be for the custom checkboxes/radios. This is required because our custom control indicators are positioned absolutely, meaning they cannot be clearfixed or anything like that. Using a computed value means it should scale nicely in case of customization
@mdo mdo added the has-pr label Oct 27, 2016
@mdo mdo added this to the v4.0.0-alpha.6 milestone Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants