Merge "mw.page.gallery: Prevent jumpiness due to viewport height changes"
[lhc/web/wiklou.git] / resources / src / mediawiki.page.gallery.js
index 82ae393..892f044 100644 (file)
@@ -1,6 +1,8 @@
 /*!
- * Show gallery captions when focused. Copied directly from jquery.mw-jump.js.
- * Also Dynamically resize images to justify them.
+ * Enhance MediaWiki galleries (from the `<gallery>` parser tag).
+ *
+ * - Toggle gallery captions when focused.
+ * - Dynamically resize images to fill horizontal space.
  */
 ( function ( mw, $ ) {
        var $galleries,
                                .addClass( 'mw-gallery-packed-overlay' )
                                .removeClass( 'mw-gallery-packed-hover' );
                } else {
-                       // Note use of just "a", not a.image, since we want this to trigger if a link in
-                       // the caption receives focus
+                       // Note use of just `a`, not `a.image`, since we also want this to trigger if a link
+                       // within the caption text receives focus.
                        $content.find( 'ul.mw-gallery-packed-hover li.gallerybox' ).on( 'focus blur', 'a', function ( e ) {
                                // Confusingly jQuery leaves e.type as focusout for delegated blur events
                                var gettingFocus = e.type !== 'blur' && e.type !== 'focusout';