Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip parent container is not removed when EditorView is destroyed #1253

Closed
kiootic opened this issue Sep 15, 2023 · 1 comment
Closed

Comments

@kiootic
Copy link

kiootic commented Sep 15, 2023

Describe the issue

When EditorView is created & destroyed repeatedly, with a tooltip parent element located outside the editor element, the tooltip container element is not removed when the EditorView is destroyed.


Reproduction code:

import {basicSetup, EditorView} from "codemirror"
import {tooltips} from '@codemirror/view';

let view;
setInterval(() => {
  view?.destroy();
  view = new EditorView({
    doc: "console.log('hello')\n",
    extensions: [basicSetup, tooltips({parent: document.body})],
    parent: document.body
  });
}, 1000);

Observe that the number of tooltip container elements keep increasing in the document body.

Browser and platform

No response

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge3Rvb2x0aXBzfSBmcm9tICdAY29kZW1pcnJvci92aWV3JzsKCmxldCB2aWV3OwpzZXRJbnRlcnZhbCgoKSA9PiB7CiAgdmlldz8uZGVzdHJveSgpOwogIHZpZXcgPSBuZXcgRWRpdG9yVmlldyh7CiAgICBkb2M6ICJjb25zb2xlLmxvZygnaGVsbG8nKVxuIiwKICAgIGV4dGVuc2lvbnM6IFtiYXNpY1NldHVwLCB0b29sdGlwcyh7cGFyZW50OiBkb2N1bWVudC5ib2R5fSldLAogICAgcGFyZW50OiBkb2N1bWVudC5ib2R5CiAgfSk7Cn0sIDEwMDApOwo=

@marijnh
Copy link
Member

marijnh commented Sep 15, 2023

This patch should help with this.

kiootic added a commit to kiootic/microservices-lab that referenced this issue Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants