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

fix(ripple): Re-flow logic to avoid crashing Edge #2542

Merged
merged 2 commits into from
Apr 10, 2018

Conversation

kfranqueiro
Copy link
Contributor

Fixes #2241.

We currently have a requestAnimationFrame call to delay a frame before checking whether the element matches the :active selector, to work around issues in Chrome and Firefox. This delay causes the crash in Edge when a submit button is interacted with.

Given that the two problems are mutually exclusive in terms of affected browsers, this means we can forego the requestAnimationFrame delay in Edge, and avoid the crash.

@codecov-io
Copy link

codecov-io commented Apr 9, 2018

Codecov Report

Merging #2542 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2542      +/-   ##
==========================================
+ Coverage   98.62%   98.62%   +<.01%     
==========================================
  Files         104      104              
  Lines        4226     4233       +7     
  Branches      530      533       +3     
==========================================
+ Hits         4168     4175       +7     
  Misses         58       58
Impacted Files Coverage Δ
packages/mdc-ripple/foundation.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6c1002...b7c71ec. Read the comment docs.

@kfranqueiro kfranqueiro force-pushed the fix/ripple-edge-explosions branch from 7d25012 to e0c4d92 Compare April 9, 2018 21:39
// Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
activatedTargets = [];

if (!activationState.wasElementMadeActive && e && e.type === 'keydown' && (e.key === ' ' || e.keyCode === 32)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove e && e.type === 'keydown' from this statement. The only way activationState.wasElementMadeActive === false is because (e && e.type == 'keydown') === true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit reluctant to assume e is defined here, but confirmed our unit tests will catch if this assumption ever becomes false.

Copy link
Contributor

@williamernest williamernest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kfranqueiro kfranqueiro merged commit 4ca8925 into master Apr 10, 2018
@kfranqueiro kfranqueiro deleted the fix/ripple-edge-explosions branch April 10, 2018 20:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants