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

has-error does not change the color of buttons in an input-group #11659

Closed
adelinor opened this issue Nov 30, 2013 · 14 comments
Closed

has-error does not change the color of buttons in an input-group #11659

adelinor opened this issue Nov 30, 2013 · 14 comments
Labels
Milestone

Comments

@adelinor
Copy link

Buttons in an input-group do not get their border colour changed when there is a parent element with has-error .

Example:

<div class="has-error" style="margin: 2em; width: 300px;">
<div class="input-group">
    <input type="text" class="form-control" value="zzz">
    <span class="input-group-btn">
        <button type="button" class="btn btn-default">Search</button>
    </span>
</div>
<p class="help-block">No results found for the provided criteria</p>
</div>

See the attached picture to see how it renders.
screen shot 2013-11-30 at 16 40 26

I would expect something more like the screen shot below.
screen shot 2013-11-30 at 16 38 42

@zlatanvasovic
Copy link
Contributor

Just change .btn-default to .btn-danger.

@cvrebert
Copy link
Collaborator

I think we can't recolor the button text in the general case because it might be a colored button already, which would make it look bad.

@adelinor
Copy link
Author

yes .btn-danger goes well in that context.

@mdo
Copy link
Member

mdo commented Nov 30, 2013

Yeah, we won't be able to do this per @cvrebert's comment.

@mdo mdo closed this as completed Nov 30, 2013
@zlatanvasovic
Copy link
Contributor

@adelinor :)

@adelinor
Copy link
Author

adelinor commented Dec 3, 2013

@zdroid 👍 many thanks. Do you know if, in theory, the change of a class in an element generates events?

@zlatanvasovic
Copy link
Contributor

jQuery or pure JS? Are you talking about changing button state class if input has error?

@zlatanvasovic
Copy link
Contributor

For you: http://jsfiddle.net/ZDroid/F7cUV/

@adelinor
Copy link
Author

adelinor commented Dec 3, 2013

Yes, I would need to change the button state class so that it is consistent with the input group class.

Your example shows exactly that, thank you very much :)

@zlatanvasovic
Copy link
Contributor

:)

2013/12/3 adelinor notifications@github.com

Yes, I would need to change the button state class so that it is
consistent with the input group class.

Your example shows exactly that, thank you very much :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/11659#issuecomment-29751997
.

Zlatan Vasović - ZDroid

@adelinor
Copy link
Author

adelinor commented Dec 8, 2013

And here is an example based on the one above with AngularJS: http://jsfiddle.net/adelinor/Pty3g/

@zlatanvasovic
Copy link
Contributor

:)

2013/12/8 adelinor notifications@github.com

And here is an example based on the one above with AngularJS:
http://jsfiddle.net/adelinor/Pty3g/


Reply to this email directly or view it on GitHubhttps://github.com//issues/11659#issuecomment-30093365
.

Zlatan Vasović - ZDroid

mdo added a commit that referenced this issue Feb 11, 2014
…orm controls in input groups for proper borders
@mdo
Copy link
Member

mdo commented Feb 11, 2014

Fixed in v3.1.1. We haven't outlined the button entirely, but we have fixed the border colors to behave more appropriately.

@mdo mdo added this to the v3.1.1 milestone Feb 11, 2014
@mdo mdo mentioned this issue Feb 11, 2014
1 task
stempler pushed a commit to stempler/bootstrap that referenced this issue Apr 11, 2014
…ition and z-index form controls in input groups for proper borders
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
…ition and z-index form controls in input groups for proper borders
@msieurtoph
Copy link

Assuming .has-warning has this effect on .input-group-addon :

.has-warning .input-group-addon {
    color: #8a6d3b;
    background-color: #fcf8e3;
    border-color: #8a6d3b;
}

Why not adding that kind of rule ?

.has-warning .input-group-btn .btn.btn-default {
    color: #8a6d3b;
    background-color: #fcf8e3;
    border-color: #8a6d3b;
}

That way, the button is colored according to input validation state, but only if it has a default style (btn-default). That seems to be the expected behavior.
And if the button has a specific helper style (btn-danger, btn-warning ...), it is not overwritten.

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

No branches or pull requests

5 participants