question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Direction-aware spacing (LTR/RTL) in v5

See original GitHub issue

It’s more a question, as I couldn’t find any indication of it in current documentation for v5. Is there any plan to support text direction aware spacing utilities? It would simplify cases where an element has assymmetrical X padding/margin. At the moment, the only option I can think of is something like the following:

<Box sx={{
    ml: (theme) => (theme.direction === 'rtl' ? .5 : 1),
    mr: (theme) => (theme.direction === 'rtl' ? 1 : .5)
}}>
    ...
</Box>

Is there a better alternative than the above? If not, what about direction-aware spacing utilities instead, e.g. (ms: margin start, me: margin end):

<Box sx={{ ms: 1, me: .5 }}>...</Box>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Jan 5, 2021

the doc about RTL plugin states you need stylis-plugin-rtl@^1, but you actually need 2.x.

Correct, it has changed since the last time we wrote this documentation. sc needs v1 when emotion needs v2. For sc, we need to wait for v6 https://github.com/styled-components/styled-components/issues/3060. We should probably update the docs.

It looks like stylis-plugin-rtl has no effect on the nested selectors.

@mnajdova I recall you mentioned that the plugin has issues. Is this one you have identified? @goffioul Maybe we should report it to the plugin’s author?

0reactions
oliviertassinaricommented, Jan 12, 2021

Is there anything else to do to on this issue? Can we close it? We have updated https://next--material-ui.netlify.app/guides/right-to-left/#3-install-the-rtl-plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Direction-aware spacing (LTR/RTL) in v5 #24270 - GitHub
Yes, I figured. It looks like emotion does not have the same dynamic as JSS, and requires to use 2 caches created statically....
Read more >
Right-to-left Styling - RTL Styling 101
Below is a basic example to show the difference between an LTR and an RTL layout. ... However, if the same letter-spacing style...
Read more >
Material-Ui Textfield Not Affected With The Rtl Direction
The best support for React 17 will be found in Material-UI v5. ... Is there any plan to support text direction aware spacing...
Read more >
direction - CSS: Cascading Style Sheets - MDN Web Docs
The direction CSS property sets the direction of text, table columns, and horizontal overflow. Use rtl for languages written from right to ...
Read more >
Structural markup and right-to-left text in HTML - W3C
You must always declare the directionality using the dir attribute. Scroll bars. The LTR/RTL direction of the page shouldn't affect the location ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found