jenkins-bot has submitted this change and it was merged.
Change subject: ve.ce.Surface: when setting selection just focus if focusTarget
== activeElement
......................................................................
ve.ce.Surface: when setting selection just focus if focusTarget == activeElement
The common case for getting here is when pressing backspace when the cursor is
in the middle of a block of text (thus both are the same <div>), and we don't
want to scroll away from the caret.
Bug: T141039
Change-Id: I634d5db7df83c40a784a308a33f03b67518c999e
---
M src/ce/ve.ce.Surface.js
1 file changed, 5 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 3b960ca..03d90a5 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -3383,7 +3383,11 @@
// Setting a range doesn't give focus in all browsers so make sure this
happens
// Also set focus after range to prevent scrolling to top
$focusTarget = $( newSel.focusNode ).closest( '[contenteditable=true]'
);
- if ( !OO.ui.contains( $focusTarget.get( 0 ),
this.getElementDocument().activeElement, true ) ) {
+ if ( !OO.ui.contains( $focusTarget.get( 0 ),
this.getElementDocument().activeElement ) ) {
+ // Note: contains *doesn't* include === here. This is desired,
as the
+ // common case for getting here is when pressing backspace when
the
+ // cursor is in the middle of a block of text (thus both are a
<div>),
+ // and we don't want to scroll away from the caret.
$focusTarget.focus();
} else {
// Scroll the node into view
--
To view, visit https://gerrit.wikimedia.org/r/304575
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I634d5db7df83c40a784a308a33f03b67518c999e
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
Gerrit-Reviewer: Divec <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits