Skip to content

Conversation

billti
Copy link
Member

@billti billti commented Jan 22, 2025

(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...

image

And sometimes the IPyWidgets 'force it to white' rule is last so the issue persists...

image

The unfortunate best hack I could come up with is to programmatically ensure the override CSS rule is always last in the styles in the header.

Not pretty, but it works.

@billti billti added this pull request to the merge queue Jan 22, 2025
Merged via the queue into main with commit 2da8354 Jan 22, 2025
18 checks passed
@billti billti deleted the billti/widget-background-fix branch January 22, 2025 23:29
idavis pushed a commit that referenced this pull request Feb 2, 2025
…ark theme (#2120)

(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...

<img width="955" alt="image"
src="https://github.com/user-attachments/assets/281524d8-a3d5-4d15-a649-442a21b5ddec"
/>

And sometimes the IPyWidgets 'force it to white' rule is last so the
issue persists...

<img width="960" alt="image"
src="https://github.com/user-attachments/assets/f60f762e-0312-49de-9a2d-6f3cf4833b20"
/>

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants