mediawiki.notification: Hide #mw-notification-area when it's empty
authorBartosz Dziewoński <matma.rex@gmail.com>
Thu, 23 Jan 2014 19:47:18 +0000 (20:47 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 25 Feb 2014 16:10:01 +0000 (17:10 +0100)
We need to hide the area manually, since it has padding, causing it to
obscure whatever is behind it in spite of being invisible.

Bug: 52659
Change-Id: I54e51b392673bc361af4e7bf703df75b83d783d4

RELEASE-NOTES-1.23
resources/mediawiki/mediawiki.notification.js

index be53faf..3f09b81 100644 (file)
@@ -142,6 +142,8 @@ production.
 * (bug 60543) Special:PrefixIndex forgot stripprefix=1 for "Next page" link
 * (bug 29762) Undoing an already-undone edit will now display an appropriate
   message instead of leading the user to make a null edit.
+* (bug 52659) mediawiki.notification: Notification area remained visible when
+  empty and thus was stealing pointer events from links on the page.
 
 === Web API changes in 1.23 ===
 * (bug 54884) action=parse&prop=categories now indicates hidden and missing
index f142fa4..b5fd69c 100644 (file)
@@ -4,6 +4,8 @@
        var notification,
                // The #mw-notification-area div that all notifications are contained inside.
                $area,
+               // Number of open notification boxes at any time
+               openNotificationCount = 0,
                isPageReady = false,
                preReadyNotifQueue = [];
 
                        autohideCount,
                        notif;
 
+               $area.show();
+
                if ( this.isOpen ) {
                        return;
                }
 
                this.isOpen = true;
+               openNotificationCount++;
 
                options = this.options;
                $notification = this.$notification;
                        return;
                }
                this.isOpen = false;
+               openNotificationCount--;
                // Clear any remaining timeout on close
                this.pause();
 
                                complete: function () {
                                        // Remove the notification
                                        $( this ).remove();
+                                       // Hide the area manually after closing the last notification, since it has padding,
+                                       // causing it to obscure whatever is behind it in spite of being invisible (bug 52659).
+                                       // It's okay to do this before getting rid of the placeholder, as it's invisible as well.
+                                       if ( openNotificationCount === 0 ) {
+                                               $area.hide();
+                                       }
                                        if ( options.placeholder ) {
                                                // Use a fast slide up animation after closing to make it look like the notifications
                                                // below slide up into place when the notification disappears