From 3dc2b10b785cea3470cbc8d2dde6fe687a772e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Sat, 21 Dec 2013 14:24:47 +0100 Subject: [PATCH] Don't show the overlay if the badge is not near the top of the window Bug: 58728 Change-Id: Ia714425078c277d65af99389c95014d87e138e8c --- modules/overlay/ext.echo.overlay.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/overlay/ext.echo.overlay.js b/modules/overlay/ext.echo.overlay.js index fd4ac2002..062d4f9eb 100644 --- a/modules/overlay/ext.echo.overlay.js +++ b/modules/overlay/ext.echo.overlay.js @@ -272,11 +272,17 @@ $link.click( function ( e ) { var $target; - e.preventDefault(); - // log the badge click mw.echo.logInteraction( 'ui-badge-link-click' ); + // If the link is not near the top of the window, showing the overlay below it + // will likely look very silly, so let's not do this and just go the special page + if ( $link.offset().top > 0.2 * $( window ).height() ) { + return; + } + + e.preventDefault(); + $target = $( e.target ); // If the user clicked on the overlay or any child, ignore the click if ( $target.hasClass( 'mw-echo-overlay' ) || $target.is( '.mw-echo-overlay *' ) ) {