Reputation: 502
I'm trying to achieve the same behavior as the MUI docs show in this link. By changing from 'ltr' to 'rtl' the 'Affected' will flip side and the 'Unaffected' won't flip.
I've created a demo illustrating the use of {flip: false}
as described in the documentation example while following the steps to apply RTL.
Expected behavior:
Actual behavior:
How can I opt-out of 'rtl' by using {flip: false}
as I did with nesting theme&div ?
Upvotes: 3
Views: 1169
Reputation: 16948
First of all, It's necessary to mention you need to use left
/right
instead of start
/end
! CSS's start
and end
are smart enough and you don't need using an extra library to manage ltr/rtl switching. Additionally, AFAIK using jss-rtl doesn't any effect on start
/end
values (w/ or w/o flip
).
But why do you see both elements on the right side, in the above image? This is because of the use of direction: "rtl"
and "start"
and is due to CSS specifications (irrelevant to jss-rtl and MUI). In RTL directions, start
means right
, NOT left
!
The second important note is in your case, both Affected and Unaffected elements are UNAFFECTED, actually (even when you correct above issue)! So we can't expect it to has any effect.
Finally, I found out you need to export your bare two elements (Affected and Unaffected div
s) into a react component:
function ReactComponent() {
const classes = useStyles();
return (
<>
<div className={classes.affected}>Affected</div>
<div className={classes.unaffected}>Unaffected</div>
</>
)
}
The fork: https://codesandbox.io/s/material-demo-forked-9w61u?file=/demo.js
Thank @mustafahlvc for his example on CodeSandbox.
Upvotes: 1