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

The function getScrollParent currently only checks style.overflowX, which is incorrect because vertical scrolling depends on overflowY. #294

Open
istarkov opened this issue Jan 29, 2025 · 0 comments

Comments

@istarkov
Copy link

istarkov commented Jan 29, 2025

The bug is here

https://github.com/flackr/scroll-timeline/blob/master/src/scroll-timeline-base.js#L570-L585

while (node = getContainingBlock(node)) {
    const style = getComputedStyle(node);
    switch(style['overflow-x']) {
      case 'auto':
      case 'scroll':
      case 'hidden':
        // https://drafts.csswg.org/css-overflow-3/#overflow-propagation
        // The UA must apply the overflow from the root element to the viewport;
        // however, if the overflow is visible in both axis, then the overflow
        // of the first visible child body is applied instead.
        if (node == document.body &&
            getComputedStyle(document.scrollingElement).overflow == "visible")
          return  document.scrollingElement;

        return node;
    }
  }

The function getScrollParent currently only checks style.overflowX, which is incorrect because vertical scrolling depends on overflowY.
This means an element will only be considered a scroll container if it has horizontal (overflowX) scrolling.

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

No branches or pull requests

1 participant