Skip to content

Commit

Permalink
fix(forms): add validation icons for <select>s and fix its position…
Browse files Browse the repository at this point in the history
… for `<textarea>` (#1371)

* Reset to Bootstrap default for feedback icon on select
* Setting the icon in the top right corner instead of center right

Co-authored-by: Julien Déramond <julien.deramond@orange.com>
  • Loading branch information
louismaximepiton and julien-deramond authored Oct 17, 2022
1 parent 71e7bca commit ceeff1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,9 @@ $form-select-bg-size: .875rem 1rem !default; // In pixels because
$form-select-indicator: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 7'><path d='M7 7 0 0h14L7 7z'/></svg>") !default;
$form-select-disabled-indicator: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 7'><path fill='#{$form-select-disabled-color}' d='M7 7 0 0h14L7 7z'/></svg>") !default; // Boosted mod

// Boosted mod: no icon for validated select
$form-select-feedback-icon-padding-end: $form-select-padding-x * 2.5 + $form-select-indicator-padding !default;
$form-select-feedback-icon-position: center right $form-select-indicator-padding !default;
$form-select-feedback-icon-size: $input-height-inner-half $input-height-inner-half !default;

$form-select-border-width: $input-border-width !default;
$form-select-border-color: $input-border-color !default;
Expand Down
14 changes: 13 additions & 1 deletion scss/mixins/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,22 @@
@include form-validation-state-selector($state) {
background-image: escape-svg($icon);
background-repeat: no-repeat;
background-position: right $input-height-inner-quarter center;
background-position: right $input-height-inner-quarter top subtract($input-height-inner-quarter, 2px);
background-size: $input-height-inner-half $input-height-inner-half;
}
}

.form-select {
@include form-validation-state-selector($state) {
&:not([multiple]):not([size]),
&:not([multiple])[size="1"] {
padding-right: $form-select-feedback-icon-padding-end;
background-image: escape-svg($form-select-indicator), escape-svg($icon);
background-position: $form-select-bg-position, $form-select-feedback-icon-position;
background-size: $form-select-bg-size, $form-select-feedback-icon-size;
}
}
}
}
} @else {
.#{$state}-feedback {
Expand Down

0 comments on commit ceeff1d

Please sign in to comment.