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: masonry scroll handler should rely on event.currentTarget issue#1414 #1420

Merged

Conversation

chinmaychaudhary
Copy link
Contributor

@chinmaychaudhary chinmaychaudhary commented Sep 9, 2019

#1414

The scroll handler should rely only on the scrolltop of event.currentTarget as any of the descendant elements' scroll event will propagate up to the container element. Relying on event.target seems incorrect.

Added a test case which fails if event.target.scrolltop is used.

Also, updated the function simulateScroll in spec file. As passing currentTarget to Simulate is not supported ( facebook/react#4950 ), changed the simulateScroll function to set the scrollTop on the desired element.

@codecov-io
Copy link

codecov-io commented Sep 9, 2019

Codecov Report

Merging #1420 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1420   +/-   ##
=======================================
  Coverage   90.35%   90.35%           
=======================================
  Files          59       59           
  Lines        1742     1742           
=======================================
  Hits         1574     1574           
  Misses        168      168
Impacted Files Coverage Δ
source/Masonry/Masonry.js 95.45% <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 a390b2a...2bc6fef. Read the comment docs.

Copy link
Contributor

@wuweiweiwu wuweiweiwu left a comment

Choose a reason for hiding this comment

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

nice catch! so it will be the element that the scroll event occurs on

@wuweiweiwu wuweiweiwu merged commit d8a1ee1 into bvaughn:master Oct 30, 2019
@chinmaychaudhary chinmaychaudhary deleted the bugfix-masonry-scroll-handler-1414 branch November 9, 2019 07:36
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