Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

fix(mdChips): Autocomplete styling is incorrect. #4621

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/chips/chips.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
$chip-font-size: rem(1.6) !default;
$chip-height: rem(3.2) !default;
$chip-padding: 0 rem(1.2) 0 rem(1.2) !default;
$chip-input-padding: 0 !default;
$chip-remove-padding-right: rem(2.2) !default;
$chip-remove-line-height: rem(2.2) !default;
$chip-margin: rem(0.8) rem(0.8) 0 0 !default;
Expand Down Expand Up @@ -62,7 +63,7 @@ $contact-chip-name-width: rem(12) !default;
&:not(.md-readonly) {
cursor: text;

.md-chip {
.md-chip:not(.md-readonly) {
padding-right: $chip-remove-padding-right;
}
}
Expand Down Expand Up @@ -122,7 +123,7 @@ $contact-chip-name-width: rem(12) !default;
display: block;
line-height: $chip-height;
margin: $chip-margin;
padding: $chip-padding;
padding: $chip-input-padding;
float: left;
input {
&:not([type]),&[type="email"],&[type="number"],&[type="tel"],&[type="url"],&[type="text"] {
Expand Down
9 changes: 8 additions & 1 deletion src/components/chips/js/chipsDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@

var CHIP_INPUT_TEMPLATE = '\
<input\
class="md-input"\
tabindex="0"\
placeholder="{{$mdChipsCtrl.getPlaceholder()}}"\
aria-label="{{$mdChipsCtrl.getPlaceholder()}}"\
Expand Down Expand Up @@ -232,7 +233,6 @@
* Configures controller and transcludes.
*/
return function postLink(scope, element, attrs, controllers) {

$mdUtil.initOptionalProperties(scope, attr);

$mdTheming(element);
Expand Down Expand Up @@ -280,6 +280,13 @@
}
});
}

// At the next tick, if we find an input, make sure it has the md-input class
$mdUtil.nextTick(function() {
var input = element.find('input');

input && input.toggleClass('md-input', true);
});
}

// Compile with the parent's scope and prepend any static chips to the wrapper.
Expand Down