jenkins-bot has submitted this change and it was merged.

Change subject: Better faking of onselectionchange
......................................................................


Better faking of onselectionchange

Improve our faking by having fake selectionchange trigger immediately
after mousedown events as well.

We were only looking at mousemove when faking selectionchange, but
real selectionchange events also fire when clicking moves the cursor.
This meant that context items wouldn't reliably appear if you clicked
into them.

Bug: T114333
Change-Id: I9d69cd9f54457421ea01dff36fd621190bfc9b4a
---
M src/ce/ve.ce.Surface.js
1 file changed, 7 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 919e63a..19fed22 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -38,7 +38,7 @@
        this.eventSequencer = new ve.EventSequencer( [
                'keydown', 'keypress', 'keyup',
                'compositionstart', 'compositionend',
-               'input'
+               'input', 'mousedown'
        ] );
        this.clipboard = [];
        this.clipboardId = String( Math.random() );
@@ -132,7 +132,13 @@
        if ( this.hasSelectionChangeEvents ) {
                this.$document.on( 'selectionchange', 
this.onDocumentSelectionChange.bind( this ) );
        } else {
+               // fake selection change events; mousemove gets optimized away 
if we're not dragging
+               // mousedown needs to run after nativemousedown, because 
otherwise the selection hasn't
+               // finished changigng
                this.$documentNode.on( 'mousemove', 
this.onDocumentSelectionChange.bind( this ) );
+               this.eventSequencer.after( {
+                       mousedown: this.onDocumentSelectionChange.bind( this )
+               } );
        }
 
        this.$element.on( {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9d69cd9f54457421ea01dff36fd621190bfc9b4a
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
Gerrit-Reviewer: Divec <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to