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: Manually dispatch scroll event #940

Merged
merged 3 commits into from
Feb 25, 2019
Merged

Conversation

ConradJChan
Copy link
Contributor

Firefox and IE11 didn't fire the scroll event when setting scrollTop, so this fix is to manually dispatch the scroll event in VirtualScroller so that the items at that scroll point will get rendered

@boxcla
Copy link

boxcla commented Feb 22, 2019

Verified that @ConradJChan has signed the CLA. Thanks for the pull request!

// Some browsers don't fire the scroll event when setting scrollTop
// (IE11 & Firefox) so we need to manually dispatch the event
// in order to trigger `onScrollHandler` to render the items
this.scrollingEl.dispatchEvent(new Event('scroll'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Any issues with the event firing twice on browsers that automatically trigger it?

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 didn't see it firing twice, but I'll double check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right it fires twice, but the scrollTop is the same so the logic to render items won't get triggered the second invocation

@ConradJChan ConradJChan merged commit 8954639 into box:master Feb 25, 2019
@ConradJChan ConradJChan deleted the scroll-event branch February 25, 2019 18:34
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.

None yet

3 participants