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

compute-scroll-into-view doesn't cope with rtl layouts #821

Open
MarkFalconbridge opened this issue Nov 19, 2021 · 2 comments
Open

compute-scroll-into-view doesn't cope with rtl layouts #821

MarkFalconbridge opened this issue Nov 19, 2021 · 2 comments

Comments

@MarkFalconbridge
Copy link

When the dir attribute of an ancestor node is set to "rtl" compute-scroll-into-view calculates the wrong scrollLeft positions.

To illustrate this I've created a jsfiddle - https://jsfiddle.net/6ckneau1/1/. When you click the "Scroll 7 into view" button in the LTR example it works just fine. When you click the "Scroll 7 into view" in the RTL example it doesn't scroll it into view.

The bug is caused by the way browsers report/use scrollLeft when in RTL. You may want to use a library like this https://github.com/alitaheri/normalize-scroll-left to address this issue.

@bakura10
Copy link

Hi !

I'm also trying to migrate all our scroll logic to this library, unfortunately RTL is indeed not working at all. Is there any plan to add support for RTL? :)

@bakura10
Copy link

@MarkFalconbridge , I've pushed a PR that adds support for RTL (#907 )

I only tried a few use cases I had, feel free to try it and let me know if you are encountering edge cases.

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

2 participants