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

EnhancedButton cannot have text-transform changed #6614

Closed
StephanBijzitter opened this issue Apr 15, 2017 · 3 comments
Closed

EnhancedButton cannot have text-transform changed #6614

StephanBijzitter opened this issue Apr 15, 2017 · 3 comments
Labels
component: button This is the name of the generic UI component, not the React module! core Infrastructure work going on behind the scenes v0.x

Comments

@StephanBijzitter
Copy link

StephanBijzitter commented Apr 15, 2017

Problem description

I use RaisedButtons that contain case-sensitive content (long story), but I am unable to set text-transform: none on the inner span element. Using buttonStyle, the transform is applied to the parent div of the span, but the span overrides it with its own inline styles.

Link to minimal working code that reproduces the issue

<RaisedButton label="foo" buttonStyle={{
    textTransform: 'none'
}}/>

With this, I would expect to see foo, but instead I see FOO. This is because it renders to:

<div style="text-transform: none">
    <span tyle="text-transform: uppercase">foo</span>
</div>

Solution

A solution would be to apply the text-transform the to parent div and then let the span inherit it:

<div style="text-transform: uppercase">
    <span tyle="text-transform: inherit">foo</span>
</div>

This way, I will be able to override it with buttonStyle correctly.

Versions

  • Material-UI: 0.17.1
  • React: 15.4.2
  • Browser: Opera 43.0.2442.1165

I'll be willing to send in a pull request if someone can list me the files that contain this logic.

@uvtzxpm
Copy link

uvtzxpm commented Apr 15, 2017

A possible workaround, pass your button content via children:

<RaisedButton>foo</RaisedButton>

Not ideal, though.

@psigns
Copy link

psigns commented Apr 16, 2017

Do you need set this on a case-by-case basis via props, or are all of your RaisedButtons case-sensitive? If you are okay setting text-transform: none for all your raised buttons, you can set this in your custom muiTheme.

  raisedButton: {
    textTransform: 'none',
  },

@StephanBijzitter
Copy link
Author

Ah, good option. Sadly it's only a part of the application :-(

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 21, 2022
@zannager zannager added component: button This is the name of the generic UI component, not the React module! v0.x core Infrastructure work going on behind the scenes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: button This is the name of the generic UI component, not the React module! core Infrastructure work going on behind the scenes v0.x
Projects
None yet
Development

No branches or pull requests

5 participants