Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

feat(radio): Move ripple to child element #4983

Merged
merged 2 commits into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/mdc-radio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ We recommend using MDC Radio with [MDC Form Field](../mdc-form-field) for enhanc
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label for="radio-1">Radio 1</label>
</div>
Expand Down Expand Up @@ -90,6 +91,7 @@ Disabled radio buttons cannot be interacted with and have no visual interaction
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label for="radio-1">Radio 1</label>
</div>
Expand Down
20 changes: 17 additions & 3 deletions packages/mdc-radio/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
@import "./functions";
@import "./variables";

$mdc-radio-ripple-target: ".mdc-radio__ripple";

@mixin mdc-radio-core-styles($query: mdc-feature-all()) {
@include mdc-radio-without-ripple($query);
@include mdc-radio-ripple($query);
Expand Down Expand Up @@ -244,9 +246,10 @@
@include mdc-ripple-common($query);

.mdc-radio {
@include mdc-ripple-surface($query);
@include mdc-ripple-radius-unbounded($query: $query);
@include mdc-states($mdc-radio-baseline-theme-color, $query: $query);
@include mdc-ripple-surface($query: $query, $ripple-target: $mdc-radio-ripple-target);
@include mdc-ripple-radius-unbounded($query: $query, $ripple-target: $mdc-radio-ripple-target);
@include mdc-states(
$color: $mdc-radio-baseline-theme-color, $query: $query, $ripple-target: $mdc-radio-ripple-target);

&.mdc-ripple-upgraded--background-focused {
.mdc-radio__background::before {
Expand All @@ -256,6 +259,17 @@
}
}
}

#{$mdc-radio-ripple-target} {
@include mdc-feature-targets($feat-structure) {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
}
}

@mixin mdc-radio-unchecked-stroke-color($color, $query: mdc-feature-all()) {
Expand Down
4 changes: 4 additions & 0 deletions test/screenshot/spec/mdc-radio/classes/baseline.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-1">1</label>
</div>
Expand All @@ -62,6 +63,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-2">2</label>
</div>
Expand All @@ -74,6 +76,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-3">3</label>
</div>
Expand All @@ -86,6 +89,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-4">4</label>
</div>
Expand Down
12 changes: 12 additions & 0 deletions test/screenshot/spec/mdc-radio/mixins/mixins.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-1">1</label>
</div>
Expand All @@ -64,6 +65,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-2">2</label>
</div>
Expand All @@ -76,6 +78,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-3">3</label>
</div>
Expand All @@ -88,6 +91,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-4">4</label>
</div>
Expand All @@ -102,6 +106,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-5">5</label>
</div>
Expand All @@ -114,6 +119,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-6">6</label>
</div>
Expand All @@ -126,6 +132,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-7">7</label>
</div>
Expand All @@ -138,6 +145,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-8">8</label>
</div>
Expand All @@ -152,6 +160,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-9">9</label>
</div>
Expand All @@ -164,6 +173,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-10">10</label>
</div>
Expand All @@ -176,6 +186,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-11">11</label>
</div>
Expand All @@ -188,6 +199,7 @@
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label class="test-radio-label" for="test-radio-12">12</label>
</div>
Expand Down