diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js
index 2261e4bc1cf..b27038fdcf1 100644
--- a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js
+++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js
@@ -536,7 +536,11 @@ function addRow(editor, beforeOrAfter) {
if (!row) return;
const newRow = document.createElement('tr');
const cells = row.querySelectorAll('td');
- newRow.append(...Array.from(Array(cells.length)).map(() => document.createElement('td')));
+ newRow.append(...Array.from(Array(cells.length)).map(() => {
+ const td = document.createElement('td');
+ td.append(document.createElement('br'));
+ return td;
+ }));
row[beforeOrAfter](newRow);
}
function deleteTable(editor, table) {
diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js
index 8566470d559..85c329b10ac 100644
--- a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js
+++ b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js
@@ -3882,6 +3882,18 @@ X[]
});
});
+ describe('tables', () => {
+ describe('tab', () => {
+ it('should add a new row on press tab at the end of a table', async () => {
+ await testEditor(BasicEditor, {
+ contentBefore: '
',
+ stepFunction: async editor => triggerEvent(editor.editable, 'keydown', { key: 'Tab'}),
+ contentAfter: '',
+ });
+ });
+ });
+ });
+
// Note that arrow keys test have a contentAfter that is not reflective of
// reality. The browser doesn't apply the selection change after triggering
// an event programmatically so what we are testing here is that if a custom