Skip to content

Commit

Permalink
fix(chips): Reset touch target when chip density mixin is applied. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
joyzhong authored Sep 23, 2019
1 parent bdf3430 commit d3b515e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/mdc-chips/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -638,4 +638,32 @@ $mdc-chip-ripple-target: ".mdc-chip__ripple";
);

@include mdc-chip-height($height, $query: $query);

@if $density-scale != 0 {
@include mdc-chip-touch-target-reset_;
}
}

///
/// Resets touch target-related styles. This is called from the density mixin to
/// automatically remove the increased touch target, since dense components
/// don't have the same default a11y requirements.
/// @access private
///
@mixin mdc-chip-touch-target-reset_($query: mdc-feature-all()) {
$feat-structure: mdc-feature-create-target($query, structure);

// Selector is necessary here to override original specificity.
&.mdc-chip--touch {
@include mdc-feature-targets($feat-structure) {
margin-top: 0;
margin-bottom: 0;
}
}

.mdc-chip__touch {
@include mdc-feature-targets($feat-structure) {
display: none;
}
}
}

0 comments on commit d3b515e

Please sign in to comment.