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

Select is not getting vertically aligned with TextFields #15447

Closed
2 tasks done
wellyal opened this issue Apr 22, 2019 · 3 comments
Closed
2 tasks done

Select is not getting vertically aligned with TextFields #15447

wellyal opened this issue Apr 22, 2019 · 3 comments
Labels
component: select This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@wellyal
Copy link

wellyal commented Apr 22, 2019

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

Select should be getting vertically aligned with TextFields

Current Behavior 😯

Select is not getting vertically aligned with TextFields

Steps to Reproduce 🕹

https://codesandbox.io/s/04npwwox1v

Tech Version
Material-UI v3.9.2
React v16.6.3
Browser chrome
@oliviertassinari oliviertassinari added the component: select This is the name of the generic UI component, not the React module! label Apr 23, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Apr 23, 2019

I remember working on issues closely related to this one. The tradeoff taken was to choose a vertical alignment that is consistent between the browsers. I'm not sure we can do much about it. The simplest workaround is to use a display flex container.

In #14580 I have found that we can potentially remove a div from the select, it always helps.

@wellyal
Copy link
Author

wellyal commented Apr 23, 2019

@oliviertassinari I'm not sure if I got this right can you edit my sandbox and show how you do the trick?

@oliviertassinari oliviertassinari added the support: question Community support but can be turned into an improvement label Apr 23, 2019
@oliviertassinari
Copy link
Member

@wellyal Oh no, my bad. I have overlooked the topic, the fix is simple:

-<FormControl className={classes.formSelect}>
+<FormControl className={classes.formSelect} margin="normal">

If you want to keep using the same level of abstraction:

          <TextField
            label="Tipo"
            name="type"
            style={{ minWidth: 100 }}
            className={classes.textField}
            id="type"
            margin="normal"
            select
            value={formikProps.values.type}
            onChange={formikProps.handleChange}
            displayEmpty
          >
            {documentsType.map(option => (
              <MenuItem key={option.value} value={option.value}>
                {option.label}
              </MenuItem>
            ))}
          </TextField>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

2 participants