-
Notifications
You must be signed in to change notification settings - Fork 48.9k
Attach scroll/wheel to root: alternative scroll browser locking fix #13460
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dc1efa8
Locally attach wheel, scroll and touch events
nhunzaker 5cfd074
Add test coverage for doubly nested event handlers
nhunzaker 86fba7c
Attach scroll and wheel events to owner
nhunzaker e425017
Track event dispatches to prevent duplicate local events
nhunzaker b675ece
Bubble scroll/wheel for consistency. Capturing does not matter
nhunzaker 8dd071e
Check event, not tracker
nhunzaker 808984e
Revert flow-type change
nhunzaker 31027a6
Attach scroll and wheel events to owner
nhunzaker 117664b
Revert silly renaming
nhunzaker 9489e92
Revert whitespace change
nhunzaker 1361a81
Revert hasOwnProperty changes
nhunzaker 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
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,72 @@ | ||
const React = global.React; | ||
|
||
function wait(time) { | ||
console.log('Blocking!'); | ||
var startTime = new Date().getTime(); | ||
var endTime = startTime + time; | ||
while (new Date().getTime() < endTime) { | ||
// wait for it... | ||
} | ||
console.log('Not blocking!'); | ||
} | ||
|
||
var scrollable = { | ||
width: 300, | ||
height: 200, | ||
overflowY: 'auto', | ||
margin: '0 auto', | ||
background: '#ededed', | ||
}; | ||
|
||
class ScrollFixture extends React.Component { | ||
componentDidMount() { | ||
// jank up the main thread! | ||
this.jank = setInterval(() => wait(3000), 4000); | ||
} | ||
|
||
componentWillUnmount() { | ||
clearInterval(this.jank); | ||
} | ||
|
||
onWheel() { | ||
console.log('wheel'); | ||
} | ||
|
||
onTouchStart() { | ||
console.log('touch start'); | ||
} | ||
|
||
onTouchMove() { | ||
console.log('touch move'); | ||
} | ||
|
||
render() { | ||
let listItems = []; | ||
|
||
// This is to produce a long enough page to allow for scrolling | ||
for (var i = 0; i < 50; i++) { | ||
listItems.push(<li key={i}>List item #{i + 1}</li>); | ||
} | ||
|
||
return ( | ||
<section> | ||
<h2>Scroll Testing</h2> | ||
<p> | ||
Mouse wheel, track pad scroll, and touch events should not be blocked | ||
by JS execution in IE Edge, Safari, and Firefox. | ||
</p> | ||
<div | ||
style={scrollable} | ||
onTouchStart={this.onTouchStart} | ||
onTouchMove={this.onTouchMove} | ||
onWheel={this.onWheel}> | ||
<h2>I am scrollable!</h2> | ||
<ul>{listItems}</ul> | ||
</div> | ||
<ul>{listItems}</ul> | ||
</section> | ||
); | ||
} | ||
} | ||
|
||
export default ScrollFixture; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
@gaearon you mentioned that touch events were essential (#9333 (comment)), would you like me to add them to the list here?