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
This commit is contained in:
jdlrobson 2016-09-19 14:19:11 -07:00 committed by Bmansurov
parent 9f92324b4d
commit f974a024f4
2 changed files with 8 additions and 0 deletions

View file

@ -258,6 +258,9 @@
if ( action === 'opened in same tab' ) { if ( action === 'opened in same tab' ) {
window.location.href = $activeLink.attr( 'href' ); window.location.href = $activeLink.attr( 'href' );
} }
// close the popup
mw.popups.render.closePopup();
}; };
/** /**

View file

@ -138,6 +138,11 @@
mw.popups.$content = $content; mw.popups.$content = $content;
$elements = mw.popups.selectPopupElements(); $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 ) { $elements.on( 'mouseenter focus', function ( event ) {
var $link = $( this ); var $link = $( this );