Material-ui: Label Text left aligned when dir=rtl

Created on 29 Nov 2017  ·  11Comments  ·  Source: mui-org/material-ui


When using a RTL language, the label text seems to still be left aligned.



Expected Behavior


Label text should be right aligned when dir="rtl"

Current Behavior


Label text is always left aligned:

| dir="ltr" | dir="rtl" |
|--------------|---------|
|screen shot 2017-11-29 at 4 41 34 pm|screen shot 2017-11-29 at 3 03 04 pm|

Steps to Reproduce (for bugs)


Here is a minimal demo: https://942ywwnk4w.codesandbox.io/

Context


My labels are showing on misaligned, as per the screenshot above.


Inspecting the styles shows the text is transformed to top left instead of top right

.MuiInputLabel-formControl-188 {
    top: 0;
    left: 0;
    position: absolute;
    transform: translate(0, 23px) scale(1);
}

.MuiInputLabel-root-187 {
    transform-origin: top left;
}

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | beta.22 |
| React | 16.1 |
| browser | Chrome |

question

Most helpful comment

this has nothing to do with the theme.

Indeed. I found the instructions confusing. Thanks!

All 11 comments

Make sure you've properly set up rtl for material-ui ( you can find it in the docs ). I'm sure you haven't properly set up rtl support. The docs are working properly when rtl.

@alitaheri I think he has: https://codesandbox.io/s/m5nl4547yp

Wait, the demo is all broken.

I think we can close, the demo is invalid, plus it's working on the documentation side:
capture d ecran 2017-11-29 a 16 55 45

Can you elaborate about what is invalid in the demo?

@mbrevda You need to follow the steps of the documentation: https://material-ui-next.com/guides/right-to-left/

I did step 1 2 & 3 seem to apply only for custom themes? Or did I misunderstand?

@mbrevda No, 3 has nothing to do with the theme. But you need a custom theme for 2.

this has nothing to do with the theme.

Indeed. I found the instructions confusing. Thanks!

@mbrevda Since you've been through the exercise, please could you submit a small PR to clarify the docs in the area you found confusing? It would help us and everyone else. 👍

I was thinking of a RTL component that would alleviate a lot of the pain.
I'm not familiar enough with either jss or this project, but I put
something together for myself. It seems a component (if doable/scalable)
would be a lot simpler?

On Wed, Nov 29, 2017, 9:49 PM Matt Brookes notifications@github.com wrote:

@mbrevda https://github.com/mbrevda Since you've been through the
exercise, please could you submit a small PR to clarify the docs in the
area you found confusing? It would help us and everyone else. 👍


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mui-org/material-ui/issues/9332#issuecomment-347975420,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAR4jBj6hyhdSyYlColNcUjDnkuhxDmNks5s7bVVgaJpZM4QvE8o
.

Was this page helpful?
0 / 5 - 0 ratings