Skip to content

Add background color to option elements for improved visibility #2047

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

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

clicktodev
Copy link
Contributor

@clicktodev clicktodev commented Jan 20, 2025

Improved visibility of option elements by adding a background color. this is because select transparency doesn't apply to option elements so it defaults to white which breaks in dark mode

before
image

after
image

Copy link

@clicktodev clicktodev marked this pull request as ready for review January 20, 2025 21:54
@josevalim
Copy link
Member

@hichemfantar thank you, but this is weird/unexpected. Which browser/OS are you using? Instead of adding a color, can we ask it to add the browser default styling instead, based on the browser defaults for light/dark mode?

@clicktodev
Copy link
Contributor Author

It is the default browser style, the reason this is happening is because the select has background transparency set which also applies to the options. But since options in windows and Linux don’t support the transparency style, they end up going white which causes the text to blend in with the bg since text in dark mode becomes whiteish

@clicktodev
Copy link
Contributor Author

This is expected behavior and the fix as seen above is simple. It applies to all selects in the website

@josevalim
Copy link
Member

But shouldn't we set it only for the option inside the sidebar though? To keep it contained?

@clicktodev
Copy link
Contributor Author

clicktodev commented Jan 21, 2025

First the select is being used in multiple places with transparent bg.
next time another transparent select is added, one could easily forget to set the bg color because the behavior is only visible in dark mode and on certain OSes.

also this fix makes sure all select options follow the theme colors by default, users can easily override with a special selector but i hardly think that will ever be necessary.

@josevalim josevalim merged commit 6a6b03d into elixir-lang:main Jan 21, 2025
4 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@clicktodev clicktodev deleted the fix-select-option-bg branch January 21, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants