diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js index 309e9700477..d3d9e1bbf36 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js @@ -2230,7 +2230,8 @@ export class OdooEditor extends EventTarget { */ _handleSelectionInTable(ev=undefined) { const selection = this.document.getSelection(); - const anchorNode = selection.anchorNode; + // Selection could be gone if the document comes from an iframe that has been removed. + const anchorNode = selection && selection.getRangeAt(0) && selection.anchorNode; if (anchorNode && (closestElement(anchorNode, '[data-oe-protected="true"]') || !ancestors(anchorNode).includes(this.editable))) { return false; }