odoo/odoo#195704

Created by Walid Sahli (wasa)
Merged at 9afe9619a0c12da034974fcaf0645a19d35fdd86

Statuses:

label
odoo-dev:16.0-opw-4505962-fix_cursor_navigation-wasa
head
4c0297de7bea70ec7b326993c124636c27405014
merged
3 months ago by Editor, David Monjoie (dmo)
odoo/odoo
16.0 #195704
17.0 #198391
saas-17.4 #198471
18.0 #198483
saas-18.1 #198501
saas-18.2 #198526
saas-18.3
master #198554

[FIX] web_editor: prevent unnecessary `feff` wrapping in links

Problem:
Wrapping links with feff chars allows placing the cursor
at their inner or outer edge. However, if the parent is
contenteditable=false, this behavior is unnecessary since
navigation outside the link is already blocked.

Example:
<div contenteditable=false>/ZWS/<a contenteditable=true>
/ZWS/ab[]c</a></div>
Pressing the left arrow key repeatedly places the cursor
at the start of a, before feff:
<div contenteditable=false>/ZWS/<a contenteditable=true>
[]/ZWS/abc</a></div>
This forces an extra left-arrow press to move past a,
which is redundant since only the link itself is editable.

Solution:
Wrap links with feff only if their parent element is
contenteditable=true.

Steps to Reproduce:
1. Add a Form snippet.
2. Focus on the "Submit" button.
3. Press the "Home" button to move the cursor to the start.
4. Press the right arrow key twice.
- Expected: Cursor moves after the first visible char.
- Issue: Cursor stops prematurely before the character.

opw-4505962


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr