romkor / svelte-portal

Svelte component for rendering outside the DOM of parent component
https://svelte.dev/repl/407576d4fa984cfb97dcdd3da98e833e
MIT License
439 stars 21 forks source link

Open portal on popup #142

Closed metehus closed 2 years ago

metehus commented 2 years ago

Goal

I wan't to open a new window in popup mode and modify it's content via a svelte component, but it didn't work, with the error of the target isn't a HTMLElement or a selector

Example

Stackblitz link

Expected behaviour

Be possible to render a component inside an opened popup

metehus commented 2 years ago

Got it to work! The solution was to create an element on the current document, and append it to the window document