Skip to content

Commit a719625

Browse files
Move Sonner toaster styles into shadow DOM
1 parent 38003e6 commit a719625

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/lib/studio/studio-widget.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ function injectStyles(node: HTMLElement, attempt = 0) {
100100
link.setAttribute(STYLE_ATTRIBUTE, 'true');
101101
shadow.prepend(link);
102102
ensureMonacoStyles(shadow);
103+
// workaround for https://github.com/emilkowalski/sonner/issues/361
104+
document.head.querySelectorAll('style').forEach((styleEl) => {
105+
if (styleEl.textContent?.includes('[data-sonner-toaster]')) {
106+
shadow.append(styleEl);
107+
}
108+
});
103109
})
104110
.catch(() => {
105111
/* no-op */

0 commit comments

Comments
 (0)