Skip to content

Commit

Permalink
fix(text-field): Make outline visibility directly linked to floating …
Browse files Browse the repository at this point in the history
…labels (#2073)
  • Loading branch information
lynnmercier authored Jan 30, 2018
1 parent 04a6ee6 commit 6129f45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
20 changes: 1 addition & 19 deletions packages/mdc-textfield/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,6 @@
}

@mixin mdc-text-field-outlined-focused_ {
.mdc-text-field__idle-outline {
opacity: 0;
}

.mdc-text-field__outline {
opacity: 1;
}

.mdc-text-field__outline-path {
stroke-width: 2px;
}
Expand Down Expand Up @@ -237,8 +229,6 @@
height: 56px;
border: none;

// stylelint-disable plugin/selector-bem-pattern

.mdc-text-field__input {
display: flex;
height: 30px;
Expand All @@ -260,22 +250,14 @@
z-index: 2;
}

.mdc-text-field__label--float-above ~ .mdc-text-field__idle-outline {
opacity: 0;
}

// stylelint-disable plugin/selector-bem-pattern
.mdc-text-field__input:hover ~ .mdc-text-field__idle-outline {
border: 1px solid;
}

.mdc-text-field__icon:hover ~ .mdc-text-field__idle-outline {
border: 1px solid $mdc-text-field-outlined-hover-border;
}

.mdc-text-field__label--float-above ~ .mdc-text-field__outline {
opacity: 1;
}

// stylelint-enable plugin/selector-bem-pattern
}

Expand Down
12 changes: 12 additions & 0 deletions packages/mdc-textfield/mdc-text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,15 @@
.mdc-text-field--textarea.mdc-text-field--disabled {
@include mdc-text-field-textarea-disabled_;
}

// Never show the idle outline when the label is floating, otherwise the label
// will collide with the idle outline.
.mdc-text-field__label--float-above ~ .mdc-text-field__idle-outline {
opacity: 0;
}

// Show the outline when the label is floating, since the outline has a
// notch for the label to fit into.
.mdc-text-field__label--float-above ~ .mdc-text-field__outline {
opacity: 1;
}

0 comments on commit 6129f45

Please sign in to comment.