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

Change subject: mw.ViewPageTarget: Don't handle edt tab clicks from special 
mouse buttons
......................................................................


mw.ViewPageTarget: Don't handle edt tab clicks from special mouse buttons

Regular mouse button click is normalised to which=1 by jQuery.

Change-Id: I08a711d8251613144ba6b463d4d240aedd98bb2a
---
M modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
index 3c10afa..fa5dac5 100644
--- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
@@ -555,6 +555,13 @@
  * @param {jQuery.Event} e Mouse click event
  */
 ve.init.mw.ViewPageTarget.prototype.onEditTabClick = function ( e ) {
+       // Default mouse button is normalised by jQuery to key code 1.
+       // Only do our handling if no keys are pressed, mouse button is 1
+       // (e.g. not middle click or right click) and no modifier keys
+       // (e.g. cmd-click to open in new tab).
+       if ( ( e.which && e.which !== 1 ) || e.shiftKey || e.altKey || 
e.metaKey ) {
+               return;
+       }
        this.logEvent( 'Edit', { action: 'edit-link-click' } );
        this.activate();
        // Prevent the edit tab's normal behavior
@@ -568,6 +575,9 @@
  * @param {jQuery.Event} e Mouse click event
  */
 ve.init.mw.ViewPageTarget.prototype.onEditSectionLinkClick = function ( e ) {
+       if ( ( e.which && e.which !== 1 ) || e.shiftKey || e.altKey || 
e.metaKey ) {
+               return;
+       }
        this.logEvent( 'Edit', { action: 'section-edit-link-click' } );
        this.saveEditSection( $( e.target ).closest( 'h1, h2, h3, h4, h5, h6' 
).get( 0 ) );
        this.activate();
@@ -582,6 +592,9 @@
  * @param {jQuery.Event} e Mouse click event
  */
 ve.init.mw.ViewPageTarget.prototype.onViewTabClick = function ( e ) {
+       if ( ( e.which && e.which !== 1 ) || e.shiftKey || e.altKey || 
e.metaKey ) {
+               return;
+       }
        if ( this.active ) {
                this.deactivate();
                // Prevent the edit tab's normal behavior

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I08a711d8251613144ba6b463d4d240aedd98bb2a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to