From f974a024f4fa1d817a85cec0f151b26542333a1a Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Mon, 19 Sep 2016 14:19:11 -0700 Subject: [PATCH] Clicking a Hovercards legible link should close popup A click event is used to capture links that may be clicked via the keyboard. Bug: T143051 Change-Id: Ifd6f75c2a53d8d7b5ef9fd3f232f85b55eea24c8 --- resources/ext.popups.renderer/desktopRenderer.js | 3 +++ resources/ext.popups.targets/desktopTarget.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/resources/ext.popups.renderer/desktopRenderer.js b/resources/ext.popups.renderer/desktopRenderer.js index 0f4e0671d..362e01400 100644 --- a/resources/ext.popups.renderer/desktopRenderer.js +++ b/resources/ext.popups.renderer/desktopRenderer.js @@ -258,6 +258,9 @@ if ( action === 'opened in same tab' ) { window.location.href = $activeLink.attr( 'href' ); } + + // close the popup + mw.popups.render.closePopup(); }; /** diff --git a/resources/ext.popups.targets/desktopTarget.js b/resources/ext.popups.targets/desktopTarget.js index ceb4592a4..1db83ad9c 100644 --- a/resources/ext.popups.targets/desktopTarget.js +++ b/resources/ext.popups.targets/desktopTarget.js @@ -138,6 +138,11 @@ 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 );