Fix mw.notify not being visible if first loaded when scrolled down
authorMatt Russell <public@matt-russell.com>
Mon, 5 Oct 2015 04:00:43 +0000 (15:00 +1100)
committerMatt Russell <public@matt-russell.com>
Mon, 5 Oct 2015 04:12:35 +0000 (15:12 +1100)
This regression was caused by using $().offset() on a hidden element, which returns
the current scroll position making the script think the notification area starts
where the scroll position is, so it would not become fixed until you scroll further.

Bug: T114606
Change-Id: Ice62cf3ea7b1a29e33baeca05d1a088a68c9a785

resources/src/mediawiki/mediawiki.notification.js

index f361ec8..eeb7bb3 100644 (file)
                        // on links from hiding a notification.
                        .on( 'click', 'a', function ( e ) {
                                e.stopPropagation();
-                       } )
-                       .hide();
+                       } );
 
                // Prepend the notification area to the content area and save it's object.
                mw.util.$content.prepend( $area );
                offset = $area.offset();
+               $area.hide();
 
                function updateAreaMode() {
                        var isFloating = $window.scrollTop() > offset.top;