Material-ui: Native Select when using Dark theme on Windows Browsers has white text on white background

Created on 29 Jan 2019  路  6Comments  路  Source: mui-org/material-ui

When using the Native Select from Material-UI if you use the dark theme then the select dropdown has white text on a white background.

This is seen on the component demo page too when in dark mode:

material-ui issue

Can you change the background color without changing the actual select background color?

Thanks!

bug 馃悰 Select good first issue important

All 6 comments

@Davsadi Thank you for reporting the problem. I think that we can fix the problem like this:

--- a/packages/material-ui/src/NativeSelect/NativeSelect.js
+++ b/packages/material-ui/src/NativeSelect/NativeSelect.js
@@ -31,7 +31,7 @@ export const styles = theme => ({
     cursor: 'pointer',
     '&:focus': {
       // Show that it's not an text input
-      background:
+      backgroundColor:
         theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.05)',
       borderRadius: 0, // Reset Chrome style
     },
@@ -45,6 +45,9 @@ export const styles = theme => ({
     '&[multiple]': {
       height: 'auto',
     },
+    '& option, & optgroup': {
+      backgroundColor: theme.palette.background.paper,
+    },
   },
   /* Styles applied to the `Input` component if `variant="filled"`. */
   filled: {

capture d ecran 2019-01-29 a 22 56 12

What do you think about it? Do you want to submit a pull-request? :)

@oliviertassinari - thanks so much for the response. Unfortunately, I'm a total noob and just playing with material-ui and react for the first time to build a web app so not sure how to go about submitting a pull-request!

ps - great job on material-ui - it's an awesome framework!

@oliviertassinari What kind of test expectations would you have on a change like this?

@ryancogswell We don't have any test for this. I doubt we can. I have tried the changes on Browserstack.

@Davsadi despite the size of the codebase, it's honestly pretty straightforward: https://github.com/mui-org/material-ui/blob/master/CONTRIBUTING.md

@oliviertassinari That's what I figured -- just wanted to make sure there wasn't a testing approach you use for something like this that I was unaware of. I had independently come up with a similar fix when responding to Davsadi's StackOverflow question. I'll take care of the pull request.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amcasey picture amcasey  路  70Comments

mnajdova picture mnajdova  路  105Comments

iceafish picture iceafish  路  62Comments

kybarg picture kybarg  路  164Comments

HZooly picture HZooly  路  63Comments