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
This commit is contained in:
Baha 2016-09-28 16:17:46 -04:00 committed by Bmansurov
parent ae96fddb40
commit 3c0ea0f9cd
2 changed files with 4 additions and 7 deletions

View file

@ -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 )

View file

@ -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 );