@@ -416,7 +416,7 @@ def get_uid_str(uid):
416
416
}
417
417
418
418
function VitessceWidget(props) {
419
- const { model } = props;
419
+ const { model, styleContainer } = props;
420
420
421
421
const [config, setConfig] = React.useState(prependBaseUrl(model.get('config'), model.get('proxy'), model.get('has_host_name')));
422
422
const [validateConfig, setValidateConfig] = React.useState(true);
@@ -480,7 +480,7 @@ def get_uid_str(uid):
480
480
height, theme, config, onConfigChange, validateConfig,
481
481
pluginViewTypes, pluginCoordinationTypes,
482
482
pluginFileTypes,pluginJointFileTypes, pluginAsyncFunctions,
483
- remountOnUidChange, stores, pageMode,
483
+ remountOnUidChange, stores, pageMode, styleContainer,
484
484
};
485
485
486
486
return e('div', { ref: divRef, style: { height: height + 'px' } },
@@ -495,7 +495,10 @@ def get_uid_str(uid):
495
495
}
496
496
497
497
const root = createRoot(view.el);
498
- root.render(e(VitessceWidget, { model: view.model }));
498
+ // Marimo puts AnyWidgets in a Shadow Root, so we need to tell Emotion to
499
+ // insert styles within the Shadow DOM.
500
+ const styleContainer = view.el.getRootNode();
501
+ root.render(e(VitessceWidget, { model: view.model, styleContainer }));
499
502
500
503
return () => {
501
504
// Re-enable scrolling.
0 commit comments