Skip to content

Commit

Permalink
fix: dialog losts css
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed Nov 5, 2019
1 parent 18d013a commit dc15ade
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/jss/ShadowRootPortal.tsx
@@ -1,10 +1,11 @@
import { livingShadowRoots } from './ConstructableStyleSheetsRenderer'
import { livingShadowRoots, applyAdoptedStyleSheets } from './ConstructableStyleSheetsRenderer'
import { GetContext } from '@holoflows/kit/es'
import { untilDocumentReady } from '../utils'

const div = document.createElement('div')
const shadow = div.attachShadow({ mode: 'closed' })
untilDocumentReady().then(() => document.body.appendChild(div))
livingShadowRoots.add(shadow)

export function PortalShadowRoot() {
if (GetContext() === 'options') return document.body
Expand All @@ -13,7 +14,7 @@ export function PortalShadowRoot() {
const value = Reflect.get(target, key)
if (typeof value === 'function')
return function(...args: any[]) {
console.log(...args)
applyAdoptedStyleSheets()
return Reflect.apply(value, shadow, args)
}
return value
Expand Down

0 comments on commit dc15ade

Please sign in to comment.