Interact.js not working with elements in iframes if they was created in parent window
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 804
- PR merge metrics
- No merged PRs in 30d
Description
Actual behavior
I have an iframe inserted into my main site and I need to create elements inside the iframe from the parent context. But interact.js doesn't work if I create new elements from the parent context and then insert them in the iframe. In a real application I cannot create nodes from an iframe document, because the elements are created by the framework (Riot.js) and I cannot control the creation of components.
Demo:
https://jsfiddle.net/kachurun/bugqc5dk/79/
Problem on this line:
https://github.com/taye/interact.js/blob/55d5d57c4f1ad2f728109bb839f1ed99a45d8ba1/packages/%40interactjs/utils/is.ts#L29
Because thing really not instance of _window.Element, but instance of win.window.Element.
I'm not sure if I know the correct way to fix this, except to add a check to the parent window, or remove the DOM2 part of the condition.
System configuration
interact.js version: 1.10.3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at packages/@interactjs/utils/is.ts line 29 and reproduce the iframe scenario from the linked JSFiddle, where elements created in the parent are inserted into the iframe. Trace the window and Element checks, then verify that interact.js recognizes and handles those elements without breaking existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100