From f68cfbd3069e7a260db1e696e20cac2c4495a7cd Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 17 Dec 2015 11:52:39 -0800 Subject: [PATCH] jquery.suggestions: Improve comment about avoiding click interference Change-Id: I971f6163f08cd419c29cac372157c0336b5fd132 --- resources/src/jquery/jquery.suggestions.js | 4 ++-- .../src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 719eacb3ea..01d9a43d61 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -674,7 +674,7 @@ if ( $result.get( 0 ) !== $other.get( 0 ) ) { return; } - // Do not interfere with non-left clicks or if modifier keys are pressed (e.g. ctrl-click). + // Don't interfere with special clicks (e.g. to open in new tab) if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) { $.suggestions.highlight( context, $result, true ); if ( typeof context.config.result.select === 'function' ) { @@ -707,7 +707,7 @@ if ( $special.get( 0 ) !== $other.get( 0 ) ) { return; } - // Do not interfere with non-left clicks or if modifier keys are pressed (e.g. ctrl-click). + // Don't interfere with special clicks (e.g. to open in new tab) if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) { if ( typeof context.config.special.select === 'function' ) { context.config.special.select.call( $special, context.data.$textbox ); diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js b/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js index 46960f55b9..84533aa957 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js @@ -53,7 +53,7 @@ // Allow opening the link in new tab, but not regular navigation. this.$label.on( 'click', function ( e ) { - // Do not interfere with non-left clicks or if modifier keys are pressed (e.g. ctrl-click). + // Don't interfere with special clicks (e.g. to open in new tab) if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) { e.preventDefault(); } -- 2.20.1