-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add custom element option to WindowScroller #481
Closed
andrewbranch
wants to merge
43
commits into
bvaughn:master
from
andrewbranch:window-scroller-custom-element
+378
−142
Closed
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
b7ac151
Add util for abstracting API differences between window and other con…
andrewbranch 754cb2a
Modify onScroll utils to accept arbitrary scroll element
andrewbranch 1981162
Allow WindowScroller to receive custom scrollElement prop
andrewbranch b9399dd
Fix copy/paste error
andrewbranch a0df5f8
Look at what element scroll listener was attached to, not initiator
andrewbranch 57efa5f
Update demo to include custom scroll element option
andrewbranch 27f2b69
Fix case where prop changes from custom element to nothing
andrewbranch e06f19e
Make sure my custom element is scrolling, not ContentBox
andrewbranch ca60f00
Auto fix linter errors
andrewbranch 8da79fb
Fix linter errors / things that will break server-side
andrewbranch 6fd41a0
Update pointerEvents assertions
andrewbranch 18612a6
Fix failing "restore pointer events on unmount" test
andrewbranch 8ff9cfc
Add missing _updateDimensions call
andrewbranch dc7a7ac
Replace PropTypes.object with any for HTMLElement props
andrewbranch 2a90fbf
Add autoprefixer-loader (for now?)
andrewbranch 36e14b6
Prevent internal scroll position overwriting scroll position from props
a8f039f
Updated cellRenderer callback parameters to also match List rowRenderer
romulof 42493ce
Update CellMeasurer documentation
romulof 2ddaed2
Fixed code-style issue
romulof 919e342
Updated tests for new CellMeasurer render :index param
197a5c3
Removed outdated warning about using CellMeasurer with List now that …
c7bb0b7
Updated CHANGELOG in advance of upcoming release
cc83019
Merge pull request #482 from lic-nz/fix-scroll-position-from-props
mbrevda 643d8a2
Minor formatting tweaks
05570f8
Updated CHANGELOG for upcoming release
2a721a7
Prepping 8.6.0 release
fe11056
Revert "Add autoprefixer-loader (for now?)"
andrewbranch 78781c7
Revert "Modify onScroll utils to accept arbitrary scroll element"
andrewbranch 335d6df
onScroll take 2: attach listener to arbitrary scroll element, but onl…
andrewbranch 15c9fde
Revert "Update pointerEvents assertions"
andrewbranch bb804f2
Fix clearTimeout never being called
andrewbranch 29cec61
Update CellSizeCache interface for better perfomance (#486)
arusakov 5c2b141
Merge branch 'arusakov-486_cell_size_cache_optimisation'
d44dde1
Prepping for 8.6.1 release
188d691
Fix checkbox bug/typo
andrewbranch 43691da
Fix demo bug: make sure container does not shrink when Grid is not ye…
andrewbranch c86015e
Fix bug where new height was calculated with old element (never changed)
andrewbranch 2e91ec7
Added to to handle case when header items change or resize. also b…
32454e0
Reverted part of the change introduced in version 8.6.0 that changed …
36a54f9
Resolved conflicts
87fe0f1
Fix positionFromTop calculation
andrewbranch f2199ac
Add scroll handlers to distinct scrollElements
andrewbranch 7c78188
Avoid some unnecessary updates to some WindowScrollers
andrewbranch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add util for abstracting API differences between window and other con…
…tainers
commit b7ac15184eafdaa0fa0aff7936b2f8b982645cc2
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Gets the vertical scroll amount of the element, accounting for IE compatibility | ||
* and API differences between `window` and other DOM elements. | ||
*/ | ||
export function getVerticalScroll (element) { | ||
return element === window | ||
? (('scrollY' in window) ? window.scrollY : document.documentElement.scrollTop) | ||
: element.scrollTop | ||
} | ||
|
||
/** | ||
* Gets the height of the element, accounting for API differences between | ||
* `window` and other DOM elements. | ||
*/ | ||
export function getHeight (element) { | ||
return element === window | ||
? window.innerHeight | ||
: element.getBoundingClientRect().height | ||
} | ||
|
||
/** | ||
* Gets the vertical position of an element within its scroll container. | ||
* Elements that have been “scrolled past” return negative values. | ||
* Handles edge-case where a user is navigating back (history) from an already-scrolled page. | ||
* In this case the body’s top position will be a negative number and this element’s top will be increased (by that amount). | ||
*/ | ||
export function getPositionFromTop (element, container) { | ||
const containerElement = container === window ? document.documentElement : container | ||
return element.getBoundingClientRect().top - container.getBoundingClientRect().top | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I was having trouble wrapping my mind around this (previously here), so extra care in making sure this satisfies the original intention is appreciated.
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.
Okay. When I do a real review, I'll read this one carefully.