Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ripple): Only deduplicate ripple on parents whose children activated #2160

Merged
merged 2 commits into from
Feb 2, 2018

Conversation

kfranqueiro
Copy link
Contributor

This amends #2123 to check for parent/child relationship before suppressing multiple ripples on the same frame, which should allow for rare cases where it makes sense for ripples to happen on multiple unrelated surfaces at the same time (e.g. multitouch, and also helps for screenshot testing).

Checked timing on all browsers this JS loads for (non-IE/Edge) and it takes less than 1ms (generally much less in Chrome/Safari).

BREAKING CHANGE: Adds containsEventTarget(target) API to the ripple adapter.

@codecov-io
Copy link

codecov-io commented Feb 1, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2160      +/-   ##
==========================================
+ Coverage   99.14%   99.14%   +<.01%     
==========================================
  Files          90       90              
  Lines        3840     3845       +5     
  Branches      495      497       +2     
==========================================
+ Hits         3807     3812       +5     
  Misses         33       33
Impacted Files Coverage Δ
packages/mdc-ripple/foundation.js 100% <100%> (ø) ⬆️
packages/mdc-ripple/index.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 c09aeae...879a300. Read the comment docs.

Copy link
Contributor

@aprigogin aprigogin left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@patrickrodee patrickrodee left a comment

Choose a reason for hiding this comment

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

This looks good but I'm curious if we could just move the isActivating flag onto the ripple foundation as a private instance boolean that we toggle just like before, preventing any foundation from being activated twice on the same frame, regardless of what event target activated it. But... that completely precludes the possibility of ripples on parent and children nodes which IDK if that's supposed to be possible.... Anyway, LGTM!

@kfranqueiro
Copy link
Contributor Author

kfranqueiro commented Feb 2, 2018

Discussed with Patrick offline; the reason this tracks across instances is in order to avoid 2 ripples happening from the same single user interaction due to both existing in the same DOM hierarchy, so we need to track this across instances. This amends the original fix which simply ignored subsequent calls on the same frame, which had potential to ignore more events than it should.

@kfranqueiro kfranqueiro merged commit d83d5bd into master Feb 2, 2018
@kfranqueiro kfranqueiro deleted the fix/ripple-activation-dedupe-ancestor branch February 2, 2018 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants