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

Problem with stepper styling #4280

Closed
maciejmyslinski opened this issue May 17, 2016 · 8 comments
Closed

Problem with stepper styling #4280

maciejmyslinski opened this issue May 17, 2016 · 8 comments
Labels
external dependency Blocked by external dependency, we can’t do anything about it

Comments

@maciejmyslinski
Copy link

Problem description

Hello! I am using material-ui with MERN.
I try to implement stepper.
Everything works great but it looks like styling or autoprefixing is broken
zrzut ekranu 2016-05-17 o 11 43 37
Take a look at that code:
zrzut ekranu 2016-05-17 o 11 43 47
I found it is because wrongly prefixed display property.
When I fixed it like this:
zrzut ekranu 2016-05-17 o 11 44 10
everything looks pretty.
I also wonder what is this mui-prepared...

Steps to reproduce

  1. Use MERN.
  2. Install material-ui
  3. Use code for vertical linear stepper

Versions

  • Material-UI: 0.15
  • React: 15.0.1
  • Browser: Chrome 50.0.2661.102
@nathanmarks
Copy link
Member

@maciejmyslinski

I THINK this is some combination of the new rendering method in React and how the inline prefixing library works.

@nathanmarks nathanmarks added the external dependency Blocked by external dependency, we can’t do anything about it label May 17, 2016
@maciejmyslinski
Copy link
Author

@nathanmarks what can I do about it? Do you have any advice for me?

@maciejmyslinski
Copy link
Author

maciejmyslinski commented May 17, 2016

I had something like this:

const muiTheme = getMuiTheme({}, {
  userAgent: 'all',
});

and changed it to

const muiTheme = getMuiTheme({}, {
  userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',
});

it works now, and I am able to develop the app further but certainly I have to fix it before going to production. Please help me to figure out proper inline prefixing with react.

@nathanmarks
Copy link
Member

nathanmarks commented May 21, 2016

@maciejmyslinski The issue is not rooted in material-ui, we use an external library for prefixing. Can you please post here for help? https://github.com/rofrischmann/inline-style-prefixer

@robinweser
Copy link

robinweser commented May 24, 2016

@nathanmarks @maciejmyslinski It is actually not possible to use the prefixer without a userAgent (which defaults back to inline-style-prefix-all), because React 15+ does not allow passing fallback strings as inline style.
This actually breaks inline styles as they can't be used to support compatible CSS output, but they're already fixing this by introducing a new helper facebook/react#6701.

The prefixer API (at least the prefix-all by now) is already updated to return an array e.g. ['-webkit-box', '-moz-box', '-ms-flexbox', '-webkit-flex', 'flex'] which material-ui must either pass to the new helper soon or transform to css by doing sth like prefixes.join(';' + dashCase(property) + ':').

Therefore this is not really a bug within the prefixer but rather an issue with inline styles right now.

PS: The reason why you see the values comma separated is because passing an array to the style will automatically do .join(',').

@maciejmyslinski
Copy link
Author

Thank you for this research @rofrischmann!

@oliviertassinari
Copy link
Member

For anyone facing this issue with userAgent: 'all' and doing server side rendering.
Here is my hack-around:

const muiTheme = getMuiTheme();

if (process.env.PLATFORM === 'server') {
  const prepareStyles = muiTheme.prepareStyles;

  muiTheme.prepareStyles = (style) => {
    style = prepareStyles(style);

    if (typeof style.display === 'object') {
      style.display = style.display.join(';display:');
    }

    return style;
  };
}

...

<MuiThemeProvider muiTheme={muiTheme}>

@nolandg
Copy link

nolandg commented Sep 21, 2016

big thanks @oliviertassinari. Was hitting this issues in a Meteor SSR app. Works great with this hack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external dependency Blocked by external dependency, we can’t do anything about it
Projects
None yet
Development

No branches or pull requests

5 participants