Fix widgets sometimes rendering in light theme when VS Code is in a dark theme #2120
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.
(See related issues microsoft/vscode-jupyter#7161 and microsoft/vscode-jupyter#9403 for more background)
Our CSS override to address the widget theming issue wasn't working somtimes, which was very frustrating, as in Dark Mode our widgets would often appear as they should in light mode.
The reason is that the order in which the style sheets get injected is non-deterministic, and as the 'problematic' CSS rule and the override to fix it have the same specificity, it would be 'last one wins'. Sometimes our style-sheet is last and it works...
And sometimes the IPyWidgets 'force it to white' rule is last so the issue persists...
The unfortunate best hack I could come up with is to programmatically ensure the override CSS rule is always last in the
style
s in the header.Not pretty, but it works.