Comments (1)
Hmm, interesting. That error comes from here, which simply checks that the OutPortal's parent element is an instance of HTMLElement
:
react-reverse-portal/src/index.tsx
Lines 46 to 54 in caef79f
I've just done some testing on your example, and it is indeed an HTMLDivElement that should be an instance of HTMLElement, but domElement instanceof HTMLElement
and HTMLDivElement
both returns false.
I suspect this is because it's a div element created in a different window (https://github.com/rmariuzzo/react-new-window/pull/19/files is the relevant change from react-new-window).
Interestingly, your example does work perfectly for me in Firefox! It only fails in Chrome. Very odd. I'm not sure what the correct behaviour is here - is the browser wrong to say that a DOM element from a different window isn't an instance of our HTMLElement type, or is that expected? It might be worth filing a Chrome bug, or exploring the existing bugs, just to get confirmation on which of the Chrome or Firefox teams is correct here.
I am open to PRs to fix this, if you can find a reliable way to detect HTML vs SVG elements instances that works cross-browser under these constraints. I think it would be best to know for sure who is in the wrong here first though.
from react-reverse-portal.
Related Issues (20)
- iframes reload from source HOT 6
- Race condition when swapping nodes between <OutPortal/>s HOT 5
- Any way to prevent unmounting of the portal contents when changing portals that aren't located within the same component? HOT 2
- Child components are re-rendered when switching their OutPortal HOT 1
- How to Create Multiple InPortals HOT 1
- Not rendering before an outPortal is used HOT 2
- Unhandled Rejection (NotFoundError): Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node. HOT 9
- Giving style to intermediary div HOT 3
- How to *destroy* a portal? HOT 3
- Migrate from Travis to Github Actions? HOT 1
- Nextjs error HOT 1
- Queries around library usage HOT 1
- Doesn't work when there is nested `portals.OutPoral` HOT 6
- moving OutPortal doesn't cause unmount/mount, but *does* cause re-render HOT 2
- Props stay the same when InPortal content is hidden HOT 3
- Text field autoFocus doesn't work in a portal HOT 1
- Scroll position doesn't maintain HOT 2
- Some non-hook function results are not preserved after conditional OutPortal HOT 2
- Support for Preact HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-reverse-portal.