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 scroll to first video on autoplay #1184

Merged
merged 2 commits into from
Feb 18, 2024

Conversation

noam-heller1
Copy link
Contributor

@noam-heller1 noam-heller1 commented Feb 15, 2024

This fix is for desktop and mobile.
left was undefined when target.scrollLeft = 0 and target.x = undefined, so it didn't triggered the scroll.

@@ -59,7 +59,7 @@ export default class ScrollIndicator extends React.Component {
this.onHorizontalScroll = (e) => {
this.props.setGotFirstScrollIfNeeded();
const target = e.currentTarget || e.target || e;
let left = target && (target.scrollX || target.scrollLeft || target.x);
let left = target && (target.scrollX || target.scrollLeft !== undefined ? target.scrollLeft : target.x);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let left = target && (target.scrollX || target.scrollLeft !== undefined ? target.scrollLeft : target.x);
let left = target && (target.scrollX || target.scrollLeft ?? target.x);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liatv changed both

@noam-heller1 noam-heller1 changed the title fix scroll to first video on autoplay- on desktop fix scroll to first video on autoplay Feb 15, 2024
@noam-heller1 noam-heller1 merged commit f990e83 into master Feb 18, 2024
7 checks passed
@noam-heller1 noam-heller1 deleted the video-autoplay-scroll-desktop branch February 18, 2024 08:19
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.

3 participants