DLynch has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/247519

Change subject: ce.Surface afterKeyDown to better cope with adjacent grouped 
nodes
......................................................................

ce.Surface afterKeyDown to better cope with adjacent grouped nodes

If a document contains adjacent nodes in a group, cursor navigation
would only sometimes treat them as a group. Moving to after the group
and pressing left, in particular, would easily get the cursor in the
middle of the group. The cursor is _technically_ not in a non-editable
location at this time, but in practice it should be treated as being
so.

Therefore, adjust getSurroundingFocusableNode to notice when the node
it's checking could be focused in this manner.

Bug: T114545
Change-Id: I4452aa05753fdacd29b861c058ec62f9ca918a8f
---
M src/ce/ve.ce.Surface.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/19/247519/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index ecbc785..8886ca7 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -1350,6 +1350,8 @@
         * If ce=false then we have landed inside the focusable node.
         * If we land in a non-text position, assume we should have hit the node
         * immediately after the position we hit (in the direction of motion)
+        * If we land inside a sequence of grouped nodes, assume we should 
treat them as a
+        * unit instead of letting the cursor slip inside them.
 
         * @private
         * @param {Node} DOM node of cursor position
@@ -1369,8 +1371,11 @@
                        focusNode = node;
                }
                $focusNode = $( focusNode );
+               if ( $focusNode.data( 'view' ) instanceof ve.ce.Node ) {
+                       return $focusNode.data( 'view' );
+               }
                // If the first ancestor with contenteditable set is ce=true, 
then we are allowed
-               // to be inside this focusalbe node (e.g. editing a table cell 
or caption)
+               // to be inside this focusable node (e.g. editing a table cell 
or caption)
                if ( $focusNode.closest( '[contenteditable]' ).prop( 
'contenteditable' ) ) {
                        return null;
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/247519
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4452aa05753fdacd29b861c058ec62f9ca918a8f
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to