mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-14 11:15:33 +00:00
41d30615a2
* Don't reveal the menu on hover * Don't flip the dropdown arrow when open * Menus close when clicked outside Bug: T275681 Change-Id: I36f5c46422725a935c962be3194fd37bde1fa769
18 lines
538 B
JavaScript
18 lines
538 B
JavaScript
/**
|
|
* Make sure that clicking outside a menu closes it.
|
|
*/
|
|
function closeDropdownsOnClickOutside() {
|
|
$( document.body ).on( 'click', function ( ev ) {
|
|
var $closestPortlet = $( ev.target ).closest( '.mw-portlet' );
|
|
// Uncheck (close) any menus that are open.
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
$( '.vector-menu-checkbox:checked' ).not(
|
|
$closestPortlet.find( '.vector-menu-checkbox' )
|
|
).prop( 'checked', false );
|
|
} );
|
|
}
|
|
|
|
module.exports = function dropdownMenus() {
|
|
closeDropdownsOnClickOutside();
|
|
};
|