material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

DropDownMenu default label style not consistent?

Open vmaudgalya opened this issue 10 years ago • 1 comments

Hi, I've found that when I insert a DropDownMenu in different locations in my code, the default label style is not consistent.

Here is some code where I see an inconsistency:

import React from 'react'
import { RaisedButton, TextField, DropDownMenu } from 'material-ui'
import injectTapEventPlugin from 'react-tap-event-plugin'
injectTapEventPlugin()

const Details = React.createClass({

  _handleItemSubmit() {
    console.log('submitted item');
  },

  render() {
    let options = [
       { payload: '1', text: 'First' },
       { payload: '2', text: 'Second' }
    ]

    return (
      <div>
        <TextField
          hintText="Class"
          floatingLabelText="Class" />
        <DropDownMenu menuItems={options}/>
        <RaisedButton label="Submit" primary={true} onClick={this._handleItemSubmit}/>
      </div>
    )
  }

})

export default Details

And here is how it appears:

When closed: screen shot 2015-12-20 at 12 16 08 am

When open: screen shot 2015-12-20 at 12 16 13 am

Sometimes this issue is there, and sometimes it is not. At first I thought it was because some other styling was overwriting the DropDownMenu's style props but after removing all other styling, it seems like this certainly may be an issue.

Adding this as a property to the DropDownMenu seems to fix this issue.

labelStyle={{fontFamily: 'Roboto, sans-serif'}}

I've looked through the updates to this file and it seems like labelStyle might be deprecated soon. How can this be fixed? Should it be, if it will be deprecated soon? I wouldn't mind making the PR myself! :yum:

vmaudgalya avatar Dec 20 '15 08:12 vmaudgalya

That looks like a bug. I think that the font family should be applied to the root element. It should be something like https://github.com/callemall/material-ui/blob/master/src/tabs/tab.jsx#L110. A PR is welcomed :+1:

oliviertassinari avatar Dec 20 '15 10:12 oliviertassinari