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

Support complex markup with scrollToElement #268

Closed
rooby opened this issue Feb 19, 2020 · 1 comment · Fixed by #566
Closed

Support complex markup with scrollToElement #268

rooby opened this issue Feb 19, 2020 · 1 comment · Fixed by #566
Assignees
Labels

Comments

@rooby
Copy link

rooby commented Feb 19, 2020

Feature Description

Currently, scrollToElement relies on the target element's offsetParent to know where to scroll to, however if there are nested positioned elements within a scrollable area it doesn't work as expected.

You can see an example of this in https://stackblitz.com/edit/ngx-scrollbar-he4x18

There are 4 groups of 4 sections, with each group having position: relative.
This means that if I try to scroll to one of the sections, its offset is relative to the parent group, not the scrollable area, so it only works correctly for the first group.

It would be preferable if the offset was somehow determined based on the ng-scrollbar element.
Not sure how feasible it would be to get a reliable generic solution.

Use Case

The example above is very basic and there is no need to have position relative in that example, however if you have more complex markup and need positioned elements then it makes scrollToElement not useful in its current form.

@chikakow
Copy link

Having the same issue. It would be very helpful if this could be resolved asap. Thanks

@MurhafSousli MurhafSousli self-assigned this Mar 19, 2024
@MurhafSousli MurhafSousli linked a pull request Mar 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants