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 04a62824843..45cce837350 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
@@ -16,7 +16,6 @@ import {
commonParentGet,
containsUnremovable,
DIRECTIONS,
- endPos,
ensureFocus,
getCursorDirection,
getFurthestUneditableParent,
@@ -28,7 +27,6 @@ import {
preserveCursor,
setCursorStart,
setSelection,
- startPos,
toggleClass,
closestElement,
isVisible,
@@ -80,6 +78,7 @@ import {
boundariesOut,
getFontSizeDisplayValue,
rightLeafOnlyNotBlockPath,
+ lastLeaf,
} from './utils/utils.js';
import { editorCommands } from './commands/commands.js';
import { Powerbox } from './powerbox/Powerbox.js';
@@ -5069,7 +5068,7 @@ export class OdooEditor extends EventTarget {
const cursorDestination =
tds[tds.findIndex(td => closestTd === td) + (direction === DIRECTIONS.LEFT ? -1 : 1)];
if (cursorDestination) {
- setSelection(...startPos(cursorDestination), ...endPos(cursorDestination), true);
+ setCursorEnd(lastLeaf(cursorDestination));
} else if (direction === DIRECTIONS.RIGHT) {
this.execCommand('addRow', 'after');
this._onTabulationInTable(ev);
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 ab464656114..2cf72ce7aad 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
@@ -5106,7 +5106,14 @@ X[]
await testEditor(BasicEditor, {
contentBefore: '
',
stepFunction: async editor => triggerEvent(editor.editable, 'keydown', { key: 'Tab'}),
- contentAfter: '',
+ contentAfter: '',
+ });
+ });
+ it('should not select whole text of the next cell', async () => {
+ await testEditor(BasicEditor, {
+ contentBefore: '',
+ stepFunction: async editor => triggerEvent(editor.editable, 'keydown', { key: 'Tab'}),
+ contentAfter: '',
});
});
});