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.

[Drawer] RTL is broken in v5 with styled-components

See original GitHub issue

Current Behavior 😯

While using styled-components as an engine with RTL support, according to the guidelines

  • stylis-plugin-rtl
  • body is set on direction rtl
  • theme is set with direction: rtl

then the temporary Drawer comes from the wrong side.

reproduced here : https://codesandbox.io/s/temporarydrawer-material-demo-forked-qc14i?file=/index.js

try to click on the RIGHT / LEFT buttons.

Expected Behavior 🤔

the drawer comes out from the correct side

Steps to Reproduce 🕹

reproduced here : https://codesandbox.io/s/temporarydrawer-material-demo-forked-qc14i?file=/index.js

BTW, when using emotionjs as the styling engine the issue is not reproduced.

Your Environment 🌎

    "@emotion/react": "latest",
    "@material-ui/core": "5.0.0-alpha.27",
    "@material-ui/icons": "5.0.0-alpha.27",
    "@material-ui/styled-engine-sc": "^5.0.0-alpha.25",
    "clsx": "latest",
    "react": "latest",
    "react-dom": "latest",
    "styled-components": "5.2.1",
    "stylis-plugin-rtl": "1.1.0"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ehsanonlinecommented, Sep 27, 2021

if you want the Drawer to come from the right side on a rtl page, set these props:

anchor="left"
PaperProps={{ style: { left: "unset", right: 0 }, }}

the drawer animation will be correct. if you want it to come from the left side just opposite the props.

1reaction
mobincocommented, Aug 7, 2022

I fixed it by this code:

anchor="left"
PaperProps={{
    sx: {
        left: 'unset !important',
        right: '0 !important'
    }
}}
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Drawer] RTL is broken in v5 with styled-components #25336
Current Behavior While using styled-components as an engine with RTL support, according to the guidelines stylis-plugin-rtl body is set ...
Read more >
Right-to-left - Material UI - MUI
Install the rtl plugin​​ styled-components requires version 1. If you are using styled-components as a styled engine, make sure to install the correct...
Read more >
MUI5 TextField not affected with the RTL direction
1 Answer 1 · 1. HTML : Make sure the dir attribute is set on the body, otherwise native components will break: ·...
Read more >
React Navigation v5 + React Native Paper = ❤️
Avatar, Text and Switch from react-native-paper. DrawerContentScrollView component makes the drawer vertically scrollable and provides support ...
Read more >
Announcing styled-components v5: Beast Mode - Medium
50% faster server-side rendering, 22% faster client-side rendering, 31% smaller bundle size, RTL support and no breaking changes!. EJ: Updated January ...
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