Render boxes end up inside the edited content when the body itself is editable
Author: brakloCreated Sep 30, 2026Updated Sep 30, 2026
**Describe the bug**
When the whole `` is editable (a designMode or `contenteditable` document), Harper inserts its `` elements into that body. They become part of the content the user is editing, so they are saved or sent together with it.
There are two places where this happens in `packages/lint-framework/src/lint`. `Highlights.computeRenderTarget()` falls back to `el.parentElement`, which is the editable body when the target is a paragraph inside it. `PopupHandler` always attaches the suggestion popup's render box to `document.body`. Each insertion into the body is also a childList mutation in the subtree the content script observes, which triggers another scan.
**To Reproduce**
1. Open a page whose body is editable, for example `
This is an test of the Harper grammar checker.
`. 2. Wait for Harper to lint the paragraph. 3. Inspect the DOM: `document.body.querySelectorAll('harper-render-box')` returns the popup's render box, and on the render box path also the highlight's. In the Thunderbird compose window (see #1425) the popup's box, ``, ended up in the HTML of every message I sent. **Expected behavior** Harper's own elements stay outside the edited content. **Platform** Reproduced in Firefox with the page above (through a Playwright test) and in the Thunderbird compose window with the Firefox build repackaged as a MailExtension. Editors that edit a whole iframe document should be affected the same way, but I have not tested one. **Additional context** I will open a pull request with a fix and a test. I worked on this with an AI agent. I have reviewed the AI parts and edited them when appropriate.Source: Automattic/harper