Merge "Clicking Echo badge should close ULS dialog"

This commit is contained in:
jenkins-bot 2022-03-05 06:09:41 +00:00 committed by Gerrit Code Review
commit 586e1291bf
2 changed files with 17 additions and 3 deletions

View file

@ -234,7 +234,9 @@ function initDesktop() {
$badge = $( this ),
clickedSection = $badge.parent().prop( 'id' ) === 'pt-notifications-alert' ? 'alert' : 'message';
if ( e.which !== 1 || $badge.data( 'clicked' ) ) {
return false;
// Do not return false (as that calls stopPropagation)
e.preventDefault();
return;
}
$badge.data( 'clicked', true );
@ -270,8 +272,8 @@ function initDesktop() {
// Un-dim badge if loading failed
$badge.removeClass( 'mw-echo-notifications-badge-dimmed' );
} );
// Prevent default
return false;
// Prevent default. Do not return false (as that calls stopPropagation)
e.preventDefault();
} );
function pollForNotificationCountUpdates() {

View file

@ -52,6 +52,18 @@
mw.echo.ui.BadgeLinkWidget.static.tagName = 'a';
/**
* Overrides ButtonElement.prototype.onClick so that it doesn't call ev.stopPropagation.
* This ensures the dialog dismisses other open overlays e.g. ULS (See T295796 for more
* information).
*
* @inheritDoc
*/
mw.echo.ui.BadgeLinkWidget.prototype.onClick = function ( ev ) {
ev.preventDefault();
this.emit( 'click' );
};
/**
* Set the count labels for this button.
*