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

Unfocused Input bottom borders do not reference the theme #14446

Closed
1 of 2 tasks
danielbchapman opened this issue Feb 7, 2019 · 6 comments · Fixed by #14719
Closed
1 of 2 tasks

Unfocused Input bottom borders do not reference the theme #14446

danielbchapman opened this issue Feb 7, 2019 · 6 comments · Fixed by #14719
Labels
component: text field This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@danielbchapman
Copy link

danielbchapman commented Feb 7, 2019

Simply put, the TextField inputs do not reference the theme for the colors and instead use a hard coded transparent white:

https://github.com/mui-org/material-ui/blob/674c523dffd0997f08154bc3c513e200823ee228/packages/material-ui/src/FilledInput/FilledInput.js#L10-L13

//----------Suggested Code
const bottomLineColor = light ? theme.palette.common.underline
const backgroundColor = light ? 'rgba(0, 0, 0, 0.09)' : 'rgba(255, 255, 255, 0.09)';`

  • 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 🤔

I create a theme using offwhite grey colors and I expected the components to respect that

Current Behavior 😯

The components use a hard coded value based on light or dark rather than a theme.

Steps to Reproduce 🕹

N/A this appears to be a design choice/oversight

Context 🔦

I'm trying to produce a low-light "dark amber" theme for uses who work in dark settings. Eliminating white/blue channels of light is highly desirable.

Your Environment 🌎

Tech Version
Material-UI v3.6 >
React
Browser
TypeScript
etc.
@oliviertassinari oliviertassinari added good first issue Great for first contributions. Enable to learn the contribution process. component: text field This is the name of the generic UI component, not the React module! labels Feb 8, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Feb 8, 2019

@danielbchapman Thank you for raising this issue! I think that we should apply this change to the FilledInput.js component: #13825. It should make the override much simpler. Do you want to work on it? :) We can simplify these lines:
https://github.com/mui-org/material-ui/blob/674c523dffd0997f08154bc3c513e200823ee228/packages/material-ui/src/FilledInput/FilledInput.js#L80-L82

Thank you for raising the concern.

@oliviertassinari
Copy link
Member

oliviertassinari commented Feb 8, 2019

I'm trying to produce a low-light "dark amber" theme for uses who work in dark settings. Eliminating white/blue channels of light is highly desirable.

Once the suggested changed is applied, you should be able to get that output with:

const theme = createMuiTheme({
  overrides: {
    MuiFilledInput: {
      underline: {
        '&:before': {
          borderBottom: '1px solid #FF7E00',
        },
      },
    },
  },
});

https://codesandbox.io/s/l78789zrkq

@gabrielliwerant
Copy link

The above example appears to be crashing in the sandbox:

Invariant Violation
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `OverridesCss`.

@oliviertassinari
Copy link
Member

oliviertassinari commented Feb 15, 2019

@gabrielliwerant Thanks, updated.

@C-Rodg
Copy link
Contributor

C-Rodg commented Mar 2, 2019

@oliviertassinari is this still good to take? Looks like all that needs to be done is make line 80 use 'borderBottomStyle' instead of 'borderBottom', correct?

@oliviertassinari
Copy link
Member

@C-Rodg Yes, I think so :)

eps1lon pushed a commit that referenced this issue Mar 4, 2019
Simple fix for #14446.  Just changed the disable css style to only specify the border bottom style, instead of the entire border property.  This will make overrides a little simpler.

Thanks!

Closes #14446.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants