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

chore(app): Allow skipping night-aware class for TextField #3228

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

connieelee
Copy link
Contributor

@connieelee connieelee commented Dec 12, 2024

Description

https://wandb.atlassian.net/browse/WB-22311

If an element has the night-aware class, its contents won't receive the default "invert colors" treatment. Instead, dark mode styling should be explicitly defined for all inner contents. However, if you have a night-aware element inside another night-aware element, this messes up the inner element and displays it with light colors instead. I'm actually not sure how this interaction works exactly, I just know that if you remove the night-aware class from the inner element, the problem is fixed.

Many of our common comps have night-aware class attached by default and have specific dark mode styling defined. This becomes an issue if you ever need to use one of them inside another night-aware component. For example, if you're working on a feature where the design provided specific dark mode styles so you're building the feature inside a night-aware wrapper. Another example is if you have to use a night-aware common comp inside another night-aware common comp (e.g. basically anything inside a Dialog or Tooltip).

The specific issue I have right now is this TextField in the workspaces menu:

Screenshot 2024-12-12 at 9 59 06 AM

The fix I decided on is to add an isContainerNightAware prop to TextField, which will skip adding the night-aware class if true. IDK if there's a better solution or this is it. Other common comps probably need this too, but I figured I'll just start with this.

Testing

after setting isContainerNightAware to true:

Screenshot 2024-12-12 at 3 35 04 PM

@connieelee connieelee requested review from a team as code owners December 12, 2024 23:45
@connieelee connieelee merged commit abebaa8 into master Dec 12, 2024
120 checks passed
@connieelee connieelee deleted the connie/night-text-field branch December 12, 2024 23:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants