Skip to content

Commit 693d153

Browse files
committed
fix(query-bar): do not allow to clone the placeholder DOM to make sure that event listeners stay attached
1 parent 42d1aba commit 693d153

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/compass-generative-ai/src/components/ai-experience-entry.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@ ${getAIEntrySVGString()}`;
171171

172172
containerEl.appendChild(aiButtonEl);
173173

174+
// Workarond for https://github.com/codemirror/dev/issues/1519: codemirror
175+
// will try to `cloneNode` the placeholder (for somewhat good reasons) which
176+
// doesn't carry over the events we attach. There's no way to opt-out of this
177+
// behavior, so we're just overriding cloneNode function to stop this from
178+
// happening. This is covered by tests, so in case it stops working, we will
179+
// know
180+
containerEl.cloneNode = () => {
181+
return containerEl;
182+
};
183+
174184
return containerEl;
175185
}
176186

0 commit comments

Comments
 (0)