From a9acebb08602e722488e593571149d1ea5aa6b32 Mon Sep 17 00:00:00 2001 From: "Mahdi Cheikh Rouhou (macr)" Date: Tue, 30 Jan 2024 15:15:46 +0100 Subject: [PATCH] [FIX] web_editor: solve traceback table RTL scroll Commit that introduced the issue: fbc167bf84340b4bb6d0f8c59f2734814f56c6df Issue: ====== Adding a table in a long chatter message with scroll raise a traceback Steps to reproduce the issue: ============================= - Switch to RTL lang - Go to any form view and open the editor composer to create a log note - Write a lot of lines so that the scrollbar appears - Add a table - Log the note - Try to scroll -> traceback Origin of the issue: ==================== The `_onScroll` method is called and it has `this._rowUiTarget` as the row from the composer dialog which is not in the ui anymore so `closestElement(row, 'table')` will return `null`. Solution: ========= We just do nothing when the element is not connected. task-3707808 closes odoo/odoo#151800 Signed-off-by: Antoine Guenet (age) --- .../static/src/js/editor/odoo-editor/src/OdooEditor.js | 3 +++ 1 file changed, 3 insertions(+) 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 1f836e8242a..6abe41ccd45 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 @@ -2916,6 +2916,9 @@ export class OdooEditor extends EventTarget { * @param {HTMLTableRowElement|HTMLTableCellElement} element */ _positionTableUi(element) { + if (!element.isConnected) { + return; + } const tableUiContainerRect = this._tableUiContainer.getBoundingClientRect(); const isRtl = this.options.direction === 'rtl'; const isRow = element.nodeName === 'TR';