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

input-group-lg and input-group-sm override validation icon padding #30131

Closed
tmorehouse opened this issue Feb 3, 2020 · 8 comments
Closed

input-group-lg and input-group-sm override validation icon padding #30131

tmorehouse opened this issue Feb 3, 2020 · 8 comments

Comments

@tmorehouse
Copy link
Contributor

tmorehouse commented Feb 3, 2020

Version 4.4.1 (and possibly before) Haven't tested in v5 yet.

When using .is-valid or .is-invalid on a .form-control in an .input-group-lg or .input-group-sm, the right padding added to accommodate for the validation icon is reset to the input group form-control default padding (non-validated), causing long text to overlap the validation icon.

As you can see in the following image, Medium (the default input-group size) has the correct righthand padding, while the small and large input-groups do not have the correct padding to accommodate for the validation icon.

image

image

@tmorehouse
Copy link
Contributor Author

tmorehouse commented Feb 4, 2020

@mdo Perhaps the solution could be just as simple as adding an !important flag in bootstrap/scss/mixins/_forms.scss (v4-dev branch) at line 80:

.form-control {
@include form-validation-state-selector($state) {
border-color: $color;
@if $enable-validation-icons {
padding-right: $input-height-inner;
background-image: escape-svg($icon);
background-repeat: no-repeat;
background-position: right $input-height-inner-quarter center;
background-size: $input-height-inner-half $input-height-inner-half;
}
&:focus {
border-color: $color;
box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
}
}
}

 .form-control { 
   @include form-validation-state-selector($state) { 
     border-color: $color; 
  
     @if $enable-validation-icons { 
       padding-right: $input-height-inner !important;
       // ...
     }

@hirayama-onagigawa-computing

+1
I've just met the same situation.
https://jsfiddle.net/hirayama_onagigawa/xt70amuh/30/

@pricop
Copy link

pricop commented May 21, 2020

+1

I'm in the same boat. Small & Large form don't get the padding treatment the regular inputs get. The solution seems to be working fine at first glance.

@ffoodd
Copy link
Member

ffoodd commented May 29, 2020

I reproduced this on v4. After testing on v5, it's not affected only because validation styles come after input groupswhich is not the case in v4.

@twbs/css-review Not quite sure about the way to go with this:

  1. separate form validation styles in a later imported partial?
  2. moving input-group up in the imports?
  3. bumping specificity for this padding, either by using !important or adding another piece in the selector?

Any thought?

@stefanmo
Copy link

stefanmo commented Feb 2, 2021

Any fix planned for this?

@ffoodd
Copy link
Member

ffoodd commented Feb 2, 2021

Ping @twbs/css-review again :)
!important is easy enough, I don't expect any regression. We may avoid it by moving things as I mentionned, but would probably be a breaking change.

ffoodd added a commit that referenced this issue Feb 2, 2021
Fixes #30131

Issue mentions `form-control` but it impacts `.custom-select` — but not `textarea` since it has a qualifying type selector that increases its specificty.

So another way could be to set `select.custom-select` and `input.form-control`. Would there be any other tag concerned by those classes?
@ffoodd
Copy link
Member

ffoodd commented Feb 2, 2021

Just updated my reduced test case to cover more things, and opened a PR to discuss this.

@ffoodd ffoodd added the has-pr label Feb 2, 2021
@XhmikosR
Copy link
Member

Should be fixed by #32968.

XhmikosR added a commit that referenced this issue Feb 15, 2021
Fixes #30131

Issue mentions `form-control` but it impacts `.custom-select` — but not `textarea` since it has a qualifying type selector that increases its specificty.

So another way could be to set `select.custom-select` and `input.form-control`. Would there be any other tag concerned by those classes?

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
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

7 participants