Bmansurov has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/261373

Change subject: Do not re-render nearby items on middle click
......................................................................

Do not re-render nearby items on middle click

Clicking on a nearby item changes the hash so that when the
user comes back to the Special:Nearby page the browser can
scroll to the last clicked item position. On hash change
though the nearby items are re-rendered. The patch allows
changing the hash only when a Ctrl, Shift, or Meta keys are
not pressed or the middle mouse button is not clicked.

Bug: T114389
Change-Id: I3768abf8d3c94dcabfd0211683dcc896910b7d63
---
M resources/mobile.nearby/Nearby.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/73/261373/1

diff --git a/resources/mobile.nearby/Nearby.js 
b/resources/mobile.nearby/Nearby.js
index 669c67a..f79f3f5 100644
--- a/resources/mobile.nearby/Nearby.js
+++ b/resources/mobile.nearby/Nearby.js
@@ -242,7 +242,12 @@
                        this.$( 'a' ).each( function ( i ) {
                                // FIXME: not unique if multiple Nearby objects 
on same page
                                $( this ).attr( 'id', 'nearby-page-list-item-' 
+ i );
-                       } ).on( 'click', function () {
+                       } ).on( 'click', function ( ev ) {
+                               // Do not react to 'open in new tab' clicks as 
changing the hash
+                               // re-renders the view.
+                               if ( ev.altKey || ev.metaKey || ev.shiftKey || 
ev.which === 2 ) {
+                                       return;
+                               }
                                // if not on Special:Nearby/#page/page_title or 
Special:Nearby/#coord/
                                // then set hash to clicked element
                                if ( !hash.match( /^(#\/page|#\/coord)/i ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3768abf8d3c94dcabfd0211683dcc896910b7d63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>

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

Reply via email to