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-feedback on a form-group does not render correctly if the label on the form-group is not specified or removed #12873

Closed
abishekrsrikaanth opened this issue Feb 28, 2014 · 8 comments
Milestone

Comments

@abishekrsrikaanth
Copy link

When using the has-feedback class on a form and if the label on the form group is not specified then it does not render correctly.

<form>
    <div class="form-group has-success has-feedback">
        <input type="text" class="form-control" id="inputSuccess2"> 
        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
    </div>
</form>

The above code renders like this.

bootstrap_feedback_issue

@cvrebert
Copy link
Collaborator

Not labeling your form fields is bad practice to begin with.

@cvrebert cvrebert added the css label Feb 28, 2014
@abishekrsrikaanth
Copy link
Author

@cvrebert, how abt this

<form>
    <div class="form-group has-success has-feedback">
        <label class="control-label sr-only" for="inputSuccess2">Input with success</label>
        <input type="text" class="form-control" id="inputSuccess2"> 
        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
    </div>
</form>

This also has the same output

@cvrebert
Copy link
Collaborator

FWIW, .has-feedback .form-control-feedback { top: 1px; } seems to be a decent workaround in such a case.
Still, seems kinda niche. Omitting the label could make sense in a .form-inline, but the icon already displays correctly in that case.

@cvrebert
Copy link
Collaborator

cvrebert commented Mar 4, 2014

A somewhat interesting use case is given in #12911.

@mdo
Copy link
Member

mdo commented Mar 4, 2014

Yeah, there's no way to know if the label is there or not in a reliable, performant, and non-shitty way. Using a specific override as you need is the only way this scales beyond our initial styles.

@mdo mdo closed this as completed Mar 4, 2014
@cvrebert
Copy link
Collaborator

cvrebert commented Mar 4, 2014

We should document that a label is required.

@cvrebert cvrebert reopened this Mar 4, 2014
@cvrebert cvrebert added the docs label Mar 4, 2014
@cvrebert cvrebert added this to the v3.2.0 milestone Mar 4, 2014
mdo added a commit that referenced this issue Mar 4, 2014
@mdo mdo closed this as completed Mar 4, 2014
ithcy pushed a commit to stevelaz/bootstrap that referenced this issue Mar 6, 2014
* upstream/master: (45 commits)
  fix twbs#12936
  Run `grunt update-shrinkwrap`
  [email protected]
  Fixes twbs#12901: Refactors list group active state for use on non-anchors
  nav
  Fixes twbs#12848: Account for and document progress bars at 0-3%
  use full version number in deprecation note
  clarify deprecation /cc @cvrebert
  Fixes twbs#12697: Document readonly inputs
  docs for twbs#12873
  grunt after merging twbs#12917
  Grunt after merging twbs#12863
  grunt
  Fixes twbs#12868: Enables icon feedback on validation states for large/small inputs.
  Fixes twbs#12913: Remove scoped media queries from custom xs grid mixins
  Fixes twbs#12914: Darken immediate children hr elements in jumbotrons
  Fixes twbs#12916: Don't let .lead resize on viewport change
  add svg logos to brand guidelines
  Update csscomb properties. 'colon-spac'e and 'stick-brace' don't take boolean values.
  grunt
  ...

Conflicts:
	dist/css/bootstrap.css.map
	dist/css/bootstrap.min.css
@reywood
Copy link
Contributor

reywood commented Apr 10, 2014

For those using sr-only, overriding top with the sibling selector (~) seems to work:

.has-feedback label.sr-only ~ .form-control-feedback {
    top: 0;
}

This has the benefit of allowing has-feedback form-groups with non-sr-only labels to still display feedback correctly.

@davhdavh
Copy link

davhdavh commented Nov 7, 2016

This is similarly broken if the label has more than 1 line

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