-
Notifications
You must be signed in to change notification settings - Fork 674
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
Bug: [Select Component] options text color does not switch properly in dark themes #1684
Comments
Is that fixable by theme-ui in a "white-label" way though? 🤔 The Of course we can always override the default browser behavior, but I am wondering whether this should rather be a theme / color-mode responsibility (or even a system issue here?) |
I'd think most people expect components like Select to be functional out of the box across all major OS, without the need to "fix" it in each app we build. Can you link to another component package with a Select component that does not do so? I would definitely not use MacOS as the the standard - even though a lot of devs work on it, very few application users do. |
I'm with you here, my question is if this issue is indeed caused by theme-ui or by the native style applied on Windows/Linux, which theme-ui may then need to support by itself 🤷 Currently the Select component applies: background-color: inherit;
color: inherit; Default style for HTML One resolution could be to also override the color (like for instance Bumbag's Select does), potentially on dark-mode only, to streamline the style accross browsers (would that work everywhere 🤔) But since theme-ui is intended to be white-label, without default theme, thus not aware of the application theme and the colors you may or may not provide at implementation, which color should we use in that case...? Hence my question.
Arguably, theme-ui allows you to style it in your application OOTB, with the theme and/or color modes support you wish to provide. For instance the following should probably fix the color issue on all systems? Do you know another UI library with a Select component that works as you expect in all system and color modes? |
Actually Bumbag suffers this exact same issue.
Requires the use of colorModes in the theme. None of the applications where I've had users complain about this make use of this theme feature. I'd say it's pretty unreasonable to expect devs to fix this at the application level every time. I'd use the fact that this very library's docs page have failed to do so as evidence that devs won't remember to do that and probably aren't checking. Could we not do something to check that the Select's color and backgroundColor are not equal?
Black text on white background.
Material UI, but it might not be a true Select. |
I think both Theme UI and Bumbag need a fix for it. We don't even have to go "full custom styling"s way like react-spectrum — https://react-spectrum.adobe.com/react-spectrum/Picker.html. A solution like presented in the @flo-sch's sandbox would be enough. What do you guys think about adding the following to Select's styles: backgroundColor: theme => {
const background = get(theme, 'colors.background')
return typeof background === 'string' ? background : "inherit"
} This way, if colors.background is a string, or an object with Edit: Actually, scratch that. "inherit" doesn't work at all (not on my machine at least). Let's just write "background" there. |
I see one potential issue with hardcoding "background": if the theme does not set it, it would be forwarded as such: Unless those keys are always supposed to be set per specifications and we can ignore that very edgy scenario? :D
That would be optimal, but not sure how to achieve that within the APIs of theme-ui |
From my perspective, themes without a background color are "illegal" for users of Theme UI components, but yeah, we could do |
I have not tested this/I'm not sure if these are related, but isn't this more an issue with color-scheme/telling the browser we support dark mode? See the second half of https://web.dev/color-scheme/ |
I will try to make a PR for this over the weekend |
Are there some guidelines for running the development server? I'd like to preview the docs page in development against the changes I've made to Select. I'm not quite clear on how to do that though. |
Check out this doc: https://github.com/system-ui/theme-ui/blob/develop/CONTRIBUTING.md you should be able to |
Thanks! Those contributing guidelines read like the command should be Should running the docs in development mode actively reflect my changes? Before working on the change for this issue, I tried some basic changes to Would there be interest for adding Storybook to the components package? I have a configuration and custom ThemeUI addon for it that works with the latest ThemeUI version, which I use for this project: https://cartolab-gis.github.io/elements/. It's a pretty great tool for developing and providing a playground for component libraries. |
Ah, good flag on the command! PRs to improve that doc would be great.
You'll need to |
Hey guys that "preconstruct dev" in postinstall should set you up so you don't need to rebuild. Peek.2021-05-03.23-46.mp4I do have to admit that contributing docs might be a bit outdated, but uhh... for my defense I expected that "postinstall" to run automatically on your machines. This is the expected output:
Take a look at dist dirs if you're interested to see what happens there. TLDR Preconstruct is wicked smart and no watch steps burning my old laptop are needed anymore. |
Oh amazing! I haven't really used the Preconstruct setup I guess. Is there anything we should update on CONTRIBUTING? |
|
Describe the bug
The Select component options do not show up properly on Windows and Ubuntu when using a theme with dark backgrounds and light fontColors.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The select options should be visible.
Screenshots

The text was updated successfully, but these errors were encountered: