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

LinearProgress and Switch should not be flipped in right-to-left themes #28326

Open
Faraz1995 opened this issue Sep 14, 2021 · 10 comments
Open
Labels
component: LinearProgress The React component. component: progress This is the name of the generic UI component, not the React module! component: switch This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@Faraz1995
Copy link

Faraz1995 commented Sep 14, 2021

RTL does not work correctly in progress bar and switch btns with styleProvider

hi
i use styleProvider for making rtl based on docs and everything works correct but linear progress bar and switch component are completely wrong and they are fliped
here is sandBox:
https://codesandbox.io/s/material-demo-forked-08r6g?file=/index.js

i would like switch button off state goes to left and progress bar start from left side

@Faraz1995 Faraz1995 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 14, 2021
@Faraz1995 Faraz1995 changed the title RTL issue with some component RTL does not work correct with some component Sep 14, 2021
@mnajdova
Copy link
Member

Does the issue still persist in v5? If so, please create a reproduction that we can look into.

@mnajdova mnajdova added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 15, 2021
@Faraz1995
Copy link
Author

Does the issue still persist in v5? If so, please create a reproduction that we can look into.

unfortunately,yes
here is my update link:
https://codesandbox.io/s/material-demo-forked-08r6g?file=/package.json

@eps1lon
Copy link
Member

eps1lon commented Sep 17, 2021

i use styleProvider for making rtl based on docs and everything works correct but linear progress bar and switch component are completely wrong and they are fliped

So these components shouldn't be flipped in a right-to-left theme?

@Faraz1995
Copy link
Author

yes, exactly
all of our design and ui is like that and lots of rtl web site is like that and should not flipped

@eps1lon eps1lon changed the title RTL does not work correct with some component LinearProgress and Switch should not be flipped in right-to-left themes Sep 18, 2021
@eps1lon eps1lon added discussion package: system Specific to @mui/system and removed status: waiting for author Issue with insufficient information labels Sep 18, 2021
@eps1lon
Copy link
Member

eps1lon commented Sep 18, 2021

I'm getting some mixed signals here. Reading the Material Design guidelines, the LinearProgress should be mirrored:

Progress bars fill in the same direction as content is read

-- https://material.io/design/usability/bidirectionality.html#mirroring-layout

unless LinearProgress is used for media progress:

Do not mirror media playback buttons and the media progress indicator as they refer to the direction of tape being played, not the direction of time.

-- https://material.io/design/usability/bidirectionality.html#mirroring-elements

I couldn't find anything about the Switch.

It seems like there's some more in-depth research required that goes beyond "our design is that way".

@oliviertassinari oliviertassinari added the component: LinearProgress The React component. label Sep 25, 2021
@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 25, 2021

  • On YouTube in an RTL language (Arabic in my screenshot), the linear progress is LTR, so is the Switch:

Screenshot 2021-09-25 at 12 30 47

It seems that the right direction depends on the context, and so that it should be configurable with a prop.

@oliviertassinari oliviertassinari added component: switch This is the name of the generic UI component, not the React module! and removed package: system Specific to @mui/system labels Sep 25, 2021
@eps1lon
Copy link
Member

eps1lon commented Sep 28, 2021

flipForRtl is a really bad prop name that's not in the spirit of React programming i.e. not declarative. As library authors, we should summarize when to not flip and name the prop to what it's rendering. Not how it should render it.

@eps1lon eps1lon added new feature New feature or request and removed discussion labels Sep 28, 2021
@jaikamat
Copy link

jaikamat commented Oct 7, 2021

Hey folks, has this issue been claimed? Would love to work on it

@Faraz1995
Copy link
Author

  • On YouTube in an RTL language (Arabic in my screenshot), the linear progress is LTR, so is the Switch:
Screenshot 2021-09-25 at 12 30 47

It seems that the right direction depends on the context, and so that it should be configurable with a prop.

yes this is what we want in material rtl,
it would be perfect if we can change default behavior of rtl direction in material component

@oliviertassinari oliviertassinari added the component: progress This is the name of the generic UI component, not the React module! label Nov 28, 2021
@hparra
Copy link

hparra commented Mar 9, 2022

It would be nice to specify this at component level.
Wrapping LinearProgress in ThemeProvider works, but doesn't feel efficient.

I also naively tried the following:

<LinearProgress variant="determinate" value={67} sx={{
  direction: "rtl", 
}}/>

Since this is a custom component the otherwise valid CSS has no meaning to component's children. If you're okay with a hack, LinearProgress could read direction from sx and use that value to overwrite direction read from useTheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: LinearProgress The React component. component: progress This is the name of the generic UI component, not the React module! component: switch This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants