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

form-control class added to dropdown toggle button #140

Closed
ena1106 opened this issue Aug 1, 2016 · 4 comments
Closed

form-control class added to dropdown toggle button #140

ena1106 opened this issue Aug 1, 2016 · 4 comments

Comments

@ena1106
Copy link

ena1106 commented Aug 1, 2016

In the original bs-select library I noticed that the form-control class is not applied to the generated dropdown toggle button. It is left in the outer div only.

<div class="btn-group bootstrap-select bs-select form-control">
    <button type="button" class="btn dropdown-toggle btn-default" data-toggle="dropdown" title="Select CFU" aria-expanded="false">

Using this library, if the form-control class is applied to the

    element it is automatically applied also to the dropdown toggle button. I found the code for this here:

    if(className === 'form-control') {
           dropdownToggle.addClass(className);
    } 
    

    Can you explain why?
    In my project this causes me issues, since it overrides the background of the toggle button. But I guess you had a good reason for this choice.

@lordfriend
Copy link
Owner

form-control class will give the button width value 100% when you need use nyaBsSelect in an form-horizontal form.

https://github.com/twbs/bootstrap/blob/master/less/forms.less#L116

if you don't need the style of form-control, just don't use this class. it's not mandatory.

@ena1106
Copy link
Author

ena1106 commented Aug 1, 2016

I didn't explain myself well. I need the form-control class, but from what I can see it's ok to have it just in the parent element, that in my case is:
<ul class="form-control nya-bs-select" ...
If I comment out the lines that assign the class also to the button, all is working well anyway, since the width 100% is given to the button anyway from the css:

.nya-bs-select .dropdown-toggle {
    width: 100%;
    padding-right: 25px;
}

My only concern here is that the original library, with the bs-select class, is not assigning the form-control class to the button element too.
Sorry if I'm missing something.

@lordfriend
Copy link
Owner

lordfriend commented Aug 3, 2016

I have investigated the whole project. Still can't figure out why I add this line of code. But I think you're right. The form-control class is not necessary for the dropdown toggle button. And remove this class won't break current example.

@ena1106
Copy link
Author

ena1106 commented Aug 3, 2016

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants