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 RTL languages in the provided CSS #1512

Open
delucis opened this issue Aug 19, 2022 · 0 comments
Open

Support RTL languages in the provided CSS #1512

delucis opened this issue Aug 19, 2022 · 0 comments

Comments

@delucis
Copy link

delucis commented Aug 19, 2022

Describe the problem

Some languages, like Arabic, Hebrew, and Farsi among others, are written from right-to-left instead of left-to-right. Readers of “RTL” languages expect designs to follow that direction much like readers of “LTR” languages expect designs to flow in the direction of text.

The provided CSS often works poorly for RTL languages. With margins and paddings on the wrong sides of elements.

Describe the solution

We can use CSS logical properties like margin-inline-start instead of margin-left or inset-inline-end instead of right to set styles that are aware of writing direction. This allows the same styles to be used across LTR and RTL languages, just by setting a dir attribute to a parent element with the appropriate direction.

Alternatives you've considered

You could choose to toggle RTL styles via some other method either by overriding styles on .DocSearch-Container[dir="rtl"] or something and requiring the direction to be set that way. It’s more verbose and more complex to maintain but would be an alternative.

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