Iframe is broken when the component is removed from DOM by React

Open
#403 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start with the TinyMCE React component’s handling of iframe removal and reload, using the linked reproduction CodeSandbox to observe the failure. The issue does not name repository files or tests, and leaves open whether the fix belongs in this component or TinyMCE itself. Done means the editor detects the iframe reload and reinitializes, as expected for an unmount/remount.

Written by the indexing model from the issue text.

Description

bug GitHub status: escalated

What is the current behavior?
React uses add/remove to manipulate DOM. But when iframe is removed from DOM it looses its context (see https://github.com/whatwg/dom/issues/891).

TinyMce doesn't detect iframe reload

Please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox.io or similar.
https://codesandbox.io/embed/eloquent-heisenberg-du24mx?fontsize=14&hidenavigation=1&theme=dark

What is the expected behavior?

TinyMce detect iframe reload, and reinitialize (similarly to unmount/remount). Not sure if the fix should be part of main tinymce 🤔

But here is a workaround https://codesandbox.io/s/cool-meadow-zrr0t1?file=/src/index.js

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-react?

  • TinyMCE: 4.2.0
Dominant language
TypeScript
Stars
1.1k
Forks
167
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tinymce/tinymce-react

All issues in tinymce/tinymce-react

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.