Clicking Echo badge should close ULS dialog

Bug: T295796
Change-Id: I3a7f33cad4e08ce22b6e640901c965d764c9156b
This commit is contained in:
Jon Robson 2022-02-17 09:46:30 -08:00 committed by Jdlrobson
parent 30bd57d813
commit 0c074ec91a
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.
*