jenkins-bot has submitted this change and it was merged.
Change subject: ce.Surface afterKeyDown shouldn't assume .contenteditable is
boolean
......................................................................
ce.Surface afterKeyDown shouldn't assume .contenteditable is boolean
Turns out we were checking .prop('contenteditable') and assuming it'd
be a boolean, when it was really a string ('true'/'false'/'inherit').
Continue to not handle the 'inherit' case, but we'll do that later in
a tech-debt task where we switch everything like this to use the
isContentEditable property all at once.
Primary impact: this now better copes 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.
Bug: T114545
Change-Id: I4452aa05753fdacd29b861c058ec62f9ca918a8f
---
M src/ce/ve.ce.Surface.js
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Divec: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index ecbc785..d512ef0 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
@@ -1368,10 +1370,11 @@
} else {
focusNode = node;
}
+
$focusNode = $( focusNode );
// 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)
- if ( $focusNode.closest( '[contenteditable]' ).prop(
'contenteditable' ) ) {
+ if ( $focusNode.closest( '[contenteditable]' ).prop(
'contenteditable' ) === 'true' ) {
return null;
}
return $focusNode.closest( '.ve-ce-focusableNode,
.ve-ce-tableNode' ).data( 'view' ) || null;
--
To view, visit https://gerrit.wikimedia.org/r/247519
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4452aa05753fdacd29b861c058ec62f9ca918a8f
Gerrit-PatchSet: 4
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
Gerrit-Reviewer: Divec <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits