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

Bug: RTL has inverted scroll direction #69

Open
JanStevens opened this issue Sep 5, 2024 · 1 comment
Open

Bug: RTL has inverted scroll direction #69

JanStevens opened this issue Sep 5, 2024 · 1 comment

Comments

@JanStevens
Copy link

Hi,

I noticed in RTL mode the scroll direction is inversted. Looking at the code I see why, since in RTL everything is flipped using transform.

A better solution would be to rely more on the native browser capabilities like direction: rtl and dir=rtl, additionally for emotion there is a stylis plugin: https://github.com/styled-components/stylis-plugin-rtl

Which can be used like so when creating a emotion cache, you will need 2 different caches (one for ltr and one for rtl). If the user specifies isRTL you can use the different cache for example.

import rtlPlugin from 'stylis-plugin-rtl';

const cacheRtl = createCache({
  key: 'rtl',
  stylisPlugins: [rtlPlugin],
});

Regards

@karolkozer
Copy link
Owner

@JanStevens
This is currently the solution that is in Planby but the one with dir=rtl I will add to the TOD list because it has a better approach to this. I will also see this package from emotion.

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