chore(app): Allow skipping night-aware class for TextField #3228
+5
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thenight-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 anight-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:
The fix I decided on is to add an
isContainerNightAware
prop toTextField
, 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: