-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(ripple): Implement subset of improved interaction response guidelines #419
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,46 +20,37 @@ | |
|
||
@keyframes mdc-ripple-fg-radius-in { | ||
from { | ||
transform: translate(0) scale(1); | ||
// NOTE: For these keyframes, we do not need custom property fallbacks because they are only | ||
// used in conjunction with `.mdc-ripple-upgraded`. Since MDCRippleFoundation checks to ensure | ||
// that custom properties are supported within the browser before adding this class, we can | ||
// safely use them without a fallback. | ||
transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); | ||
animation-timing-function: $mdc-animation-fast-out-slow-in-timing-function; | ||
} | ||
|
||
to { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
transform: translate(0) scale(0); | ||
transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 0)); | ||
transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any reason why the default value is different from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like an oversight on my part for the |
||
} | ||
} | ||
|
||
@keyframes mdc-ripple-fg-opacity-out { | ||
@keyframes mdc-ripple-fg-opacity-in { | ||
from { | ||
opacity: 1; | ||
opacity: 0; | ||
animation-timing-function: linear; | ||
} | ||
|
||
to { | ||
opacity: 0; | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes mdc-ripple-fg-unbounded-opacity-deactivate { | ||
@keyframes mdc-ripple-fg-opacity-out { | ||
from { | ||
opacity: 1; | ||
animation-timing-function: linear; | ||
} | ||
|
||
to { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
@keyframes mdc-ripple-fg-unbounded-transform-deactivate { | ||
from { | ||
transform: 0; | ||
transform: var(--mdc-ripple-fg-approx-xf, 0); | ||
} | ||
|
||
to { | ||
transform: scale(0); | ||
transform: scale(var(--mdc-ripple-fg-scale, 0)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
@@ -28,17 +29,14 @@ | |
} | ||
|
||
@mixin mdc-ripple-base() { | ||
--mdc-ripple-surface-width: 0; | ||
--mdc-ripple-surface-height: 0; | ||
--mdc-ripple-fg-size: 0; | ||
--mdc-ripple-left: 0; | ||
--mdc-ripple-top: 0; | ||
--mdc-ripple-fg-size: 0; | ||
--mdc-ripple-surface-height: 0; | ||
--mdc-ripple-surface-width: 0; | ||
--mdc-ripple-fg-unbounded-transform-duration: 0ms; | ||
--mdc-ripple-xfo-x: center; | ||
--mdc-ripple-xfo-y: center; | ||
--mdc-ripple-fg-unbounded-opacity-duration: 0ms; | ||
--mdc-ripple-fg-unbounded-transform-duration: 0ms; | ||
--mdc-ripple-fg-approx-xf: 0; | ||
--mdc-ripple-fg-scale: 1; | ||
--mdc-ripple-fg-translate-end: 0; | ||
--mdc-ripple-fg-translate-start: 0; | ||
|
||
will-change: transform, opacity; | ||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | ||
|
@@ -121,18 +119,11 @@ | |
transform: scale(var(--mdc-ripple-fg-scale, 0)); | ||
} | ||
|
||
&.mdc-ripple-upgraded--background-active#{$pseudo} { | ||
&.mdc-ripple-upgraded--background-focused#{$pseudo} { | ||
opacity: .99999; | ||
} | ||
|
||
// When an element goes active, a foreground ripple will be triggered. | ||
// Therefore, we adjust the transition duration for the correct "wind- | ||
// up" animation. | ||
&.mdc-ripple-upgraded--background-active:active#{$pseudo} { | ||
transition-duration: 600ms; | ||
} | ||
|
||
&.mdc-ripple-upgraded--background-bounded-active-fill#{$pseudo} { | ||
&.mdc-ripple-upgraded--background-active-fill#{$pseudo} { | ||
transition-duration: 120ms; | ||
opacity: 1; | ||
} | ||
|
@@ -215,29 +206,13 @@ | |
transform-origin: center center; | ||
} | ||
|
||
&.mdc-ripple-upgraded--foreground-bounded-active-fill#{$pseudo} { | ||
animation-fill-mode: forwards; | ||
animation: 300ms mdc-ripple-fg-radius-in, 400ms mdc-ripple-fg-opacity-out; | ||
} | ||
|
||
&.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded--foreground-unbounded-activation#{$pseudo} { | ||
transform: scale(0); | ||
transform: scale(var(--mdc-ripple-fg-scale, 0)); | ||
transition: | ||
opacity 110ms linear, | ||
transform 0 linear 80ms; | ||
transition: | ||
opacity 110ms linear, | ||
transform var(--mdc-ripple-fg-unbounded-transform-duration, 0) linear 80ms; | ||
opacity: 1; | ||
&.mdc-ripple-upgraded--foreground-activation#{$pseudo} { | ||
animation: 300ms mdc-ripple-fg-radius-in forwards, 83ms mdc-ripple-fg-opacity-in forwards; | ||
} | ||
|
||
&.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded--foreground-unbounded-deactivation#{$pseudo} { | ||
animation: | ||
mdc-ripple-fg-unbounded-opacity-deactivate 0 linear, | ||
mdc-ripple-fg-unbounded-transform-deactivate 0 $mdc-animation-fast-out-slow-in-timing-function; | ||
animation: | ||
mdc-ripple-fg-unbounded-opacity-deactivate var(--mdc-ripple-fg-unbounded-opacity-duration, 0) linear, | ||
mdc-ripple-fg-unbounded-transform-deactivate var(--mdc-ripple-fg-unbounded-transform-duration, 0) $mdc-animation-fast-out-slow-in-timing-function; | ||
&.mdc-ripple-upgraded--foreground-deactivation#{$pseudo} { | ||
// Retain transform from mdc-ripple-fg-radius-in activation | ||
transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
animation: 250ms mdc-ripple-fg-opacity-out; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed? Don't we need a fallback for browsers that don't support var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #361.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BBosman good question. Typically, yes. However, this keyframe is only attached when
mdc-ripple-upgraded
is added to the ripple surface. Before we add that class, we check - within JS - to make sure custom properties are supported. Thus, fallbacks here aren't necessary....I'm going to add this explanation as a comment 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍