jenkins-bot has submitted this change and it was merged.
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 Alt, 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(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/mobile.nearby/Nearby.js
b/resources/mobile.nearby/Nearby.js
index 669c67a..b70ba62 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.ctrlKey || 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: merged
Gerrit-Change-Id: I3768abf8d3c94dcabfd0211683dcc896910b7d63
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits