From 3c0ea0f9cda987e1b4b15497837b1576c9827e70 Mon Sep 17 00:00:00 2001 From: Baha Date: Wed, 28 Sep 2016 16:17:46 -0400 Subject: [PATCH] Regression: correctly log the click action total interaction time Per T143051, hovercards was asked to be closed after the user clicks on the hovercard (or the link that showed it). Closing the popup before logging the `click` event causes `logData` to be lost. This patch logs the data first and then clears it. The regression was introduced in Ifd6f75c2a53d8d7b5ef9fd3f232f85b55eea24c8. Also do not attempt closing a popup when it may not be open. Bug: T146934 Change-Id: I02febc83036130bcea0a769114c9126cb481bafe --- resources/ext.popups.renderer/desktopRenderer.js | 6 ++++-- resources/ext.popups.targets/desktopTarget.js | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/resources/ext.popups.renderer/desktopRenderer.js b/resources/ext.popups.renderer/desktopRenderer.js index b896a3fa6..c7e599acd 100644 --- a/resources/ext.popups.renderer/desktopRenderer.js +++ b/resources/ext.popups.renderer/desktopRenderer.js @@ -147,8 +147,10 @@ linkInteractionToken: linkInteractionToken }; - $link.on( 'mouseleave blur', mw.popups.render.leaveInactive ) - .off( 'click', logClickAction ).on( 'click', logClickAction ); + $link + .on( 'mouseleave blur', mw.popups.render.leaveInactive ) + .off( 'click', mw.popups.render.clickHandler ) + .on( 'click', mw.popups.render.clickHandler ); if ( mw.popups.render.cache[ $link.attr( 'href' ) ] ) { openTimer = mw.popups.render.wait( mw.popups.render.POPUP_DELAY ) diff --git a/resources/ext.popups.targets/desktopTarget.js b/resources/ext.popups.targets/desktopTarget.js index 1db83ad9c..ceb4592a4 100644 --- a/resources/ext.popups.targets/desktopTarget.js +++ b/resources/ext.popups.targets/desktopTarget.js @@ -138,11 +138,6 @@ mw.popups.$content = $content; $elements = mw.popups.selectPopupElements(); - // On clicking a link the open popup (if any) should be hidden. (T143051) - $elements.on( 'click', function () { - mw.popups.render.closePopup(); - } ); - $elements.on( 'mouseenter focus', function ( event ) { var $link = $( this );